Method of and apparatus for processing graphics

ABSTRACT

A scene to be rendered is divided into plural individual sub-regions or tiles. The individual sub-regions  51  are also grouped into differing groups of sets of plural sub-regions. There is a top level layer comprising a set of 8×8 sub-regions which encompasses the entire scene area. There is then a group of four 4×4 sets of sub-regions, then a group of sixteen 2×2 sets of sub-regions, and finally a layer comprising the 64 single sub-regions. A primitive list building processor takes each primitive in turn, determines a location for that primitive, compares the primitive&#39;s location with the locations of the sub-regions and the locations of the sets of sub-regions, and allocates the primitive to respective primitive lists for the sub-regions and sets of sub-regions accordingly.

This application is a Continuation of U.S. patent application Ser. No.11/633,647, filed Dec. 5, 2006, which claims priority to GB ApplicationNo. 0524804.2 filed Dec. 5, 2005, the entire contents of each of whichare hereby incorporated by reference in this application.

The present invention relates to a method of and apparatus forprocessing graphics, and in particular to such a method and apparatusfor use in a tile-based graphics processing system.

The present invention will be described with particular reference to theprocessing of three-dimensional graphics, although as will beappreciated by those skilled in the art, it is equally applicable to theprocessing of two-dimensional graphics as well.

As is known in the art, graphics processing is normally carried out byfirst splitting the scene to be displayed into a number of similar basiccomponents or “primitives”, which primitives are then subjected to thedesired graphics processing operations. The graphics “primitives” areusually in the form of simple polygons, such as triangles, and areusually described by defining their vertices.

For the graphics processing operations, each graphics primitive isusually further divided, as is known in the art, into discrete graphicentities or elements, usually referred to as “fragments”, on which theactual graphics processing operations (such as rendering operations) arecarried out. Each such graphics fragment will represent and correspondto a given position in the primitive and comprise, in effect, a set ofdata (such as colour and depth values) for the position in question.

Each graphics fragment (data element) usually corresponds to a singlepixel (picture element) in the final display (since as the pixels arethe singularities in the final picture to be displayed, there willusually be a one-to-one mapping between the “fragments” the graphicsprocessor operates on and the pixels in the display). However, it can bethe case that there is not a direct correspondence between “fragments”and “pixels”, for example where particular forms of post-processing suchas down-scaling are carried out on the rendered image prior todisplaying the final image.

Thus two aspects of graphics processing that are typically carried outare the “rasterising” of graphics “primitive” (polygon) position data tographics fragment position data (i.e. determining the (x, y) positionsof the graphics fragments to be used to represent each primitive in thescene to be displayed), and then “rendering” the “rasterised” fragments(i.e. colouring, shading, etc. the fragments) for displaying on adisplay screen.

(In graphics literature, the term “rasterisation” is sometimes used tomean both primitive conversion to fragments and rendering. However,herein “rasterisation” will be used to refer to converting primitivedata to fragment addresses only.)

Many graphics processing systems use so-called “tile-based” rendering.In tile-based rendering, the two-dimensional scene to be displayed issub-divided or partitioned into a plurality of smaller sub-regions,usually referred to as “tiles”. The tiles (sub-regions) are eachrendered separately (typically one-after-another). The renderedsub-regions (tiles) are then recombined to provide the complete framefor display. In such arrangements, the scene is typically divided intoregularly-sized and shaped sub-regions (tiles) (they are usually e.g.,squares or rectangles) but this is not essential.

Other terms that are commonly used for “tiling” and “tile-based”rendering include “chunking” (the sub-regions are referred to as“chunks”) and “bucket” rendering. The terms “tile” and “tiling” will beused hereinafter for convenience, but it should be understood that theseterms are intended to encompass all alternative and equivalent terms andtechniques.

The advantage of such tile-based rendering is that primitives that donot appear in a given tile do not have to be processed for that tile,and therefore can be ignored when the tile is processed. This allows theoverall amount of graphics processing necessary for a given scene to bereduced.

In a tile-based rendering system, it is accordingly usually desirable tobe able to identify and know those primitives that are actually presentin a given sub-region (tile), so as to, e.g., avoid unnecessarilyrendering primitives that are not actually present in a tile. In orderto facilitate this, it is known to prepare for each sub-region (tile) alist of the primitives to be rendered for that sub-region (e.g. thatwill appear in the sub-region). Such a “tile-list” (which can also bereferred to as a “primitive list”) identifies (e.g. by reference to aprimitive indicator) the primitives to be rendered for the tile(sub-region) in question.

The process of preparing tile lists for each sub-region (tile) to berendered basically therefore involves determining the primitives thatshould be rendered for a given sub-region (tile). This process isusually carried out by determining (at a desired level of accuracy) theprimitives that intersect (i.e. that will appear (at least in part)within) the tile in question, and then preparing a list of thoseprimitives for future use by the graphics processing system. (It shouldbe noted here that where a primitive falls into more than one tile (aswill frequently be the case), it is included in the tile list for eachtile that it falls within.) In effect, each sub-region (tile) can beconsidered to have a bin (the tile-list) into which any primitive thatis found to fall within (i.e. intersect) the sub-region is placed (and,indeed, the process of sorting the primitives on a tile-by-tile basis inthis manner is commonly referred to as “binning”).

As known in the art, the process of determining the primitives thatshould be listed (rendered) for any given tile can be carried out atvarying levels of precision, for example depending on efficiencyoptimisations for different parts of the tiling and rendering processes.For example, at the most precise level, it could be determined exactlywhich tiles a given primitive will appear at least in part in, and theprimitive then included in the tile lists for those tiles only. This iscommonly referred to as “exact” binning.

FIG. 1 illustrates the exact binning process. As shown in FIG. 1, thescene 1 to be displayed is divided into sixteen regularly sizedsub-regions or tiles 2. It is then determined for each primitive in thescene, which tile or tiles the primitive actually appears (falls)within. The primitive is added to the tile-list for each tile that it isfound to fall within. Thus, taking the example shown in FIG. 1, theprimitive 3 is added to the tile-list for tile 4, the primitive 5 isincluded in the tile-list for tiles 6 and 7, the primitive 8 is includedin the tile lists for tiles 9, 10, 11 and 12, and the primitive 13 isincluded in the tile-list for tile 12. (It should be noted here thatFIG. 1 shows only a few tiles and primitives for clarity purposes. Aswill be appreciated by those skilled in the art, in an actual graphicsprocessing operation, there will typically be many more primitives andtiles.)

It is also known to prepare tile-lists with a lower precision than isachieved with exact binning. This can be useful to, e.g., simplify thepreparation of the tile-lists. One common “less precise” binningtechnique is “bounding box” binning. In this case, a so-called “boundingbox” is drawn around a primitive or a set of primitives, and then thetiles covered by the bounding box are determined. The primitive orprimitives that the bounding box represents (i.e. that are encompassedby the bounding box) are then listed (binned) for each tile that thebounding box has been found to cover (at least in part).

This arrangement thus uses a bounding box to determine the tiles forwhich a given primitive should be listed to be rendered, rather than theprimitive itself. This can mean, e.g., that a primitive may be listedfor rendering for a tile that it does not actually fall within (e.g. ifthe bounding box does not sufficiently tightly or precisely surround theprimitive), but on the other hand, the use of bounding boxes in thismanner can simplify the preparation of the tile-lists.

Once lists of primitives to be rendered (tile-lists) have been preparedfor each sub-region (tile) in this way, the (tile-)lists are stored foruse, e.g., to allow the system to identify which primitives need to beconsidered (and rendered) when the tile in question is rendered.

Such tile-based rendering arrangements have been found to work well, asthey can, for example, help to avoid primitives still being processedfor regions of the scene where they are not present.

However, one drawback with the need to prepare and store tile-listsidentifying the primitives to be rendered for each tile is thatdepending on the distribution of the primitives in a scene, thetile-lists for different tiles in a scene can be very different sizes,as can the tile lists for tiles in different scenes. This means that,e.g., a given scene or tile may have significantly different memoryrequirements for storing its tile list(s) as compared to other tiles orscenes. This means that, e.g., the memory requirements for the tilelists cannot be reliably predicted and will vary, e.g., depending on thedistribution of primitives in a given scene. However, it is generallybeneficial in graphics systems, particularly where they are to beimplemented on more restricted devices, such as portable devices (e.g.mobile phones, PDAs, handheld devices, etc.), to have known or at leastgenerally predictable memory usage requirements.

The Applicants believe therefore that there remains scope forimprovement to existing tile-based rendering systems.

According to a first aspect of the present invention, there is providedan apparatus for sorting graphics primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided into aplurality of sub-regions for rendering, the apparatus comprising:

means for preparing, for a single sub-region of the scene, a list ofprimitives for rendering; and

means for preparing, for a set of sub-regions comprising more than onesub-region of the scene, a list of primitives for rendering.

According to a second aspect of the present invention, there is provideda method of sorting graphics primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided into aplurality of sub-regions for rendering, the method comprising

preparing, for a single sub-region of the scene, a list of primitivesfor rendering; and

preparing, for a set of sub-regions comprising more than one sub-regionof the scene, a list of primitives for rendering.

The present invention is directed to a tile-based rendering system (i.e.one in which the scene to be rendered is divided into pluralsub-regions) in which, as in prior art tile-based rendering systems, alist of primitives for rendering can be (and is) prepared for a givensub-region (tile) of the scene. However, unlike in prior art systems, itis also possible in the system of the present invention to prepare alist of primitives for rendering for a set of plural sub-regions (tiles)of the scene (i.e. a tile list that encompasses a plurality of thesub-regions (tiles) (and thereby, in effect, a larger sub-region) of thescene).

In other words, in the present invention, separate (different) tilelists can be (and preferably are) prepared for single sub-regions(tiles) of the scene and for sets of sub-regions comprising more thanone sub-region (tile) of the scene. Thus, for example, and preferably, alist of primitives for rendering (a tile list) will be prepared for asingle sub-region of the scene, and a separate (different) list ofprimitives for rendering (tile list) will be prepared for a set ofsub-regions comprising more than one sub-region of the scene, and so on.

The possibility of preparing different scene “area” tile lists as in thepresent invention has a number of advantages. For example, as will bediscussed further below, by selectively storing primitives in singlesub-region and/or plural sub-region tile lists, the amount of memorythat is used for the tile lists can be varied. The present inventionaccordingly facilitates better control over and knowledge of the memoryusage requirements for the tile listing process. Sorting the primitivesinto different area tile lists can also be used to provide, e.g.,information about the distribution of primitives within the scene. Thismay be useful, e.g., when considering operations such as, e.g., vertexdata caching (since it could assist, e.g., in determining whether or notto cache given vertex data).

The arrangement of the present invention means that, as well aspreparing tile-lists of primitives that are exclusive to a single tileonly, tile-lists that can and will be used for plural tiles(sub-regions) in common can be and are prepared.

In other words, the present invention facilitates the (selective)storing or inclusion of primitives for rendering in tile lists havingdifferent resolutions (i.e. for different sized areas), namely, e.g., ina tile list that is exclusive to a single sub-region (tile) only and/orin a tile list that is to be used for more than one sub-region (tile) incommon. This facilitates varying and controlling the scene “resolution”at which the tile-lists are prepared and stored, and accordingly thememory requirements, etc., for the tile-lists.

Thus, according to a third aspect of the present invention, there isprovided an apparatus for sorting primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided into pluralsub-regions for rendering, the apparatus comprising:

means for including a primitive to be rendered at least in a list ofprimitives for rendering for a single sub-region of the scene or in alist of primitives to be rendered to be used for more than onesub-region of the scene in common.

According to a fourth aspect of the present invention, there is provideda method of sorting primitives for rendering in a graphics processingsystem in which a scene to be rendered is divided into pluralsub-regions for rendering, the method comprising:

selectively including a primitive to be rendered at least in a list ofprimitives for rendering for a single sub-region of the scene or in alist of primitives to be rendered to be used for more than onesub-region of the scene in common.

According to a fifth aspect of the present invention, there is providedan apparatus for sorting graphics primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided intosub-regions for rendering, the apparatus comprising:

means for including a primitive to be rendered in one or more lists ofprimitives to be rendered, wherein the lists of primitives to berendered can be exclusive to a single sub-region only or can be used formore than one sub-region of the scene.

According to a sixth aspect of the present invention, there is provideda method of sorting graphics primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided intosub-regions for rendering, the method comprising:

including a primitive to be rendered in one or more lists of primitivesto be rendered, wherein the lists of primitives to be rendered can beexclusive to a single sub-region only or can be used for more than onesub-region of the scene.

As will be appreciated by those skilled in the art, these aspects of thepresent invention can include any one or more or all of the preferredand optional features of the invention disclosed herein, as appropriate.

The sub-regions (tiles) that the scene to be rendered is divided intocan be any suitable and desired such sub-regions. They are preferablyall the same size and shape (i.e. regularly-sized and shaped tiles arepreferably used), as is known in the art, although this is notessential. The sub-regions are preferably square or rectangular. Thesize and number of sub-regions can be selected as desired. In apreferred arrangement, each sub-region (tile) is 16×16 or 32×32fragments in size (with the scene then being divided into however manysuch sub-regions as are required for the display (frame) size that isbeing used).

The set or sets of sub-regions comprising more than one sub-region forwhich a primitive list is prepared can be any desired and suitable groupor groups of the scene sub-regions. Each set of more than one sub-regionpreferably comprises an integer number of sub-regions. However, this isnot essential, and it would, e.g., be possible to prepare primitivelists for a set comprising portions of sub-regions, such as, forexample, comprising one and a half sub-regions, or three andthree-quarter sub-regions, etc. Such sets of sub-regions comprisingfractions of sub-regions may be desirable for particular, e.g., unusualor irregular, primitive shapes, and/or sizes, as they may allow suchprimitives to be more efficiently listed in the tile-lists.

In a preferred embodiment, the set of plural sub-regions, and preferablyeach set of plural sub-regions, comprises a group of contiguoussub-regions. Most preferably the or each set of sub-regions forms aregularly shaped area of the screen, such as a square or rectangle. Mostpreferably the or each set of plural sub-regions forms a square.However, again this is not essential, and more irregular groupings(shapes) of plural sub-regions, such as, e.g., an “L”-shaped grouping ora triangular shaped grouping could be used, if desired. Again suchirregular shapes may be useful for listing more unusual or irregularly,shaped and/or sized primitives.

In a preferred embodiment, the sub-regions included in a or more thanone set of plural sub-regions can be selected and varied in use. Thisallows the system to, e.g., tailor the listing of primitives for pluralsub-regions based on, e.g., the size and/or shape of the primitives tobe rendered.

In a particularly preferred embodiment, primitive lists can be preparedfor plural sets of plural sub-regions (i.e. such that there will beplural such primitive lists, each corresponding to a set of more thanone sub-region of the scene). Each set of plural sub-regions could bedifferent (e.g. in terms of their size and/or shape), but in a preferredsuch arrangement, each set of plural sub-regions has a correspondingand/or similar size and/or shape, and/or has a similar and/orcorresponding number of sub-regions (and preferably arrangement ofsub-regions) as the other sets of plural sub-regions. For example, someor all of the sets of plural sub-regions could be, and, indeed,preferably are, square in shape.

In these arrangements, each set of plural sub-regions preferablycomprises a different set of scene sub-regions to the other sets ofplural sub-regions. Each and every set of plural sub-regions couldcontain different sub-regions, or different sets of plural sub-regionscould, e.g., have some, but not all, of their sub-regions in common.

In these arrangements, the sets of plural sub-regions preferablytogether cover the entire scene, i.e. encompass all the individualsub-regions that the scene is divided into. This arrangement effectivelyprovides another layer or layers of regions that the scene is dividedinto (the sets of plural sub-regions), with each such regionencompassing a plurality of the “base” sub-regions (tiles) that thescene is divided into. In this type of arrangement, primitive lists canaccordingly be prepared at two (or more) different resolutions, eitherat a single sub-region level, or at a level of the sets of pluralsub-regions.

In a particularly preferred arrangement, the entire scene area isdivided into a group of plural sets of plural sub-regions such that thesets of plural sub-regions in the group together encompass all theindividual sub-regions that the scene is divided into, with each set ofplural sub-regions in the group preferably including the same number ofsub-regions and, preferably, having the same shape. Such a group of setsof plural sub-regions effectively provides a layer of sets ofsub-regions for which primitives can be listed overlying the base,single sub-regions “layer”. Most preferably more than one such group ofsets of plural sub-regions is provided, i.e. such that primitives can belisted in different layers (levels) if desired.

In a particularly preferred embodiment, primitive lists can be preparedfor sets of plural sub-regions that contain different numbers ofsub-regions. Thus, for example, a list could be prepared for a set of 4sub-regions, or for a set of 16 sub-regions, and so on. This allows theresolution at which the primitive lists are prepared to be furthervaried and controlled. In a preferred embodiment, there are two or more,preferably three or more, different sized sets of plural sub-regions forwhich a primitive list can be prepared, most preferably havingprogressively decreasing levels of resolution (i.e. encompassingincreasing numbers of sub-regions).

In a particularly preferred embodiment, the sets of plural sub-regionsfor which primitive lists can be prepared are arranged such that thescene is effectively overlaid by one or more layers of (groups of) setsof sub-regions and most preferably by plural layers of sets ofsub-regions. Thus, for example, there could be a layer of sets ofsub-regions which sets each encompass four sub-regions laid over thebase “layer” of the single sub-regions. There could then, e.g.,preferably also be a layer of sets of sub-regions each encompassing 16sub-regions laid over the base single sub-region layer and the “foursub-regions” layer and so on.

In such an arrangement, the sets of sub-regions for a given layerpreferably all encompass the same number of individual sub-regions, butthe sets of sub-regions in each different layer (where provided)preferably comprise a different number of sub-regions to the sets in theother layers.

Thus, in a preferred embodiment, there are preferably one or more andpreferably plural groups of sets of plural sub-regions (with each suchgroup, e.g., and preferably, together forming a layer that covers theentire scene to be rendered (i.e. encompassing all the sub-regions thatthe scene is or can be divided into), with the sets of sub-regions ineach group preferably all comprising the same number of sub-regions, andthe sets of sub-regions in different groups comprising different numbersof sub-regions.

These arrangements can allow, for example, the scene to be rendered tobe effectively covered by plural different resolution layers of sets ofplural sub-regions, with each such “layer” being made up of a group (anarrangement) of sets of plural sub-regions each containing the samenumber of sub-regions, and the sets of plural sub-regions in different“layers” containing different numbers of sub-regions.

In a particularly preferred such arrangement, the groups (layers) ofsets of sub-regions are arranged in a hierarchical fashion, i.e. suchthat the number of sub-regions in each set in each group progressivelychanges as one moves through the groups (layers). They are mostpreferably arranged such that they effectively form a square-basedpyramid structure as one progresses up the layers. The number ofsub-regions included in the sets of sub-regions for any given layer(group) preferably progressively increases as one moves up the layersfrom the base, single sub-region layer. Preferably, the sets ofsub-regions are arranged such that the sets of sub-regions in eachsuccessive layer have 4 times as many sub-regions in them as theimmediately preceding layer, i.e. such that the base layer is of singlesub-regions, there is then a layer of sets containing four sub-regions,then a layer of sets of 16 sub-regions, and so on, preferably up to asingle set of sub-regions that encompasses the entire scene to berendered. Most preferably there are, in effect, three or more suchlayers (groups) (including the “base”, single sub-region layer).

Such arrangements effectively allow primitive lists to be prepared forprogressively decreasing levels of resolution (i.e. division intosub-areas) of the scene to be rendered.

In a particularly preferred such arrangement, a primitive list can beprepared for each sub-region (tile), for each 2×2 grouping ofsub-regions, for each 4×4 grouping of sub-regions, for each 8×8 groupingof sub-regions, and so on, up to a primitive list for the entire sceneto be rendered (i.e. a list for the entire frame buffer).

As will be appreciated by those skilled in the art, where the overalldisplay area (scene) is, as will typically be the case, not square, thenit can be the case that for the larger groupings of sub-regions in thismanner, some of the sets of sub-regions will, in effect, extend beyondthe edges of the scene (display). This does not matter, because thesystem will in any event not attempt to prepare or render primitivelists for sub-regions that are not within the scene to be rendered (i.e.that lie outside the scene or display), and so the fact that a given setof sub-regions may include sub-regions that lie outside the sceneboundary does not and will not affect the primitive listing process.

In a preferred embodiment, the sets of sub-regions hierarchy ispreferably arranged such that primitive lists can, in effect, beprepared for the entire scene, for the scene divided into four regions,for the scene divided into 16 regions, for the scene divided into 64regions, and so on, down to its division into single sub-regions.

With the above arrangements, it can, for example, be ensured (by storinga given primitive at the appropriate level of resolution, i.e. for theappropriate sub-region grouping) that any given primitive will neverneed to be included in more than four primitive lists. This would allow,e.g., the memory requirement for the primitive (tile) lists to morereliably be capped (and the maximum possible memory requirement to beknown (from knowing, e.g., the number of primitives that are to berendered)).

While it is not essential that a primitive list is prepared for each andevery sub-region or set of plural sub-regions that a given scene is orcan be divided into, in a particularly preferred embodiment, a primitivelist is prepared for each sub-region (tile) that the scene is dividedinto, and for each set of more than one sub-region that primitive listscan be prepared for. (However, it should be noted that in some cases inthis arrangement the primitive lists may be and can be empty (i.e.contain no primitives), depending, e.g., on how the primitives aredistributed in the scene, and in which (tile) lists it is decided tostore the primitives in.)

Thus, according to a seventh aspect of the present invention, there isprovided an apparatus for sorting graphics primitives for rendering in agraphics processing system, in which a scene to be rendered is dividedinto plural sub-regions for rendering, and one or more sets ofsub-regions each comprising more than one sub-region of the scene aredefined, the apparatus comprising:

means for preparing a list of primitives for rendering for eachsub-region of the scene; and

means for preparing a list of primitives for rendering for each set ofmore than one sub-region of the scene.

According to an eighth aspect of the present invention, there isprovided a method of sorting graphics primitives for rendering in agraphics processing system, comprising:

dividing a scene to be rendered into a plurality of sub-regions forrendering;

defining one or more sets of sub-regions of the scene, each setcomprising more than one sub-region of the scene; and

preparing a list of primitives for rendering for each sub-region and foreach set of more than one sub-region of the scene.

As will be appreciated by those skilled in the art, these aspects of theinvention can include any one or more or all of the preferred andoptional features of the invention disclosed herein. Thus, for example,preferably sets of plural sub-regions containing different numbers ofsub-regions of the scene are prepared (and have primitive lists preparedfor them).

The listing of a primitive and the primitives in the primitive lists foreach sub-region and set of sub-regions, and the preparation of aprimitive list for each sub-region or set of plural sub-regions, can becarried out in any appropriate and desired manner. For example, anytechnique already known and used for sorting and binning primitives intotile-lists, such as exact binning, or bounding box binning, or anythingin between, can be used for this process.

Thus, for example, an initial determination of the sub-regions and setsof sub-regions that a primitive is to be rendered for could be madebased on a determined location of the primitive in the scene (whichlocation could, e.g., be the exact location of the primitive or anapproximation of the primitive's location based on, e.g., a bounding boxsurrounding the primitive, as is known in the art), and the primitivethen listed in some or all of the sub-regions or sets of pluralsub-regions that its determined location indicates it should be renderedfor. This would then be repeated for each primitive in the scene toallow a complete set of primitive lists for the scene to be prepared.

Thus, in a preferred embodiment, a location for a given primitive in thescene is determined and compared to the sub-regions and/or sets ofplural sub-regions that the scene is divided into to determine whichsub-regions and sets of plural sub-regions the primitive could or shouldbe rendered for (e.g. appears (falls) within).

Such comparison and determination of the sub-regions, etc., that aprimitive appears in can be carried out in any suitable manner, forexample using existing techniques known in the prior art for suchpurposes. Thus, for example, “exact” binning techniques as discussedabove could be used (in which case the actual sub-regions (tiles), etc.,that the primitive appears in will be determined), or a bounding boxtechnique could be used (in which case the sub-regions (tiles) that thebounding box covers will be determined, with the primitive listingaccordingly potentially being less exact and including sub-regions thatthe primitive does not actually appear in, as is known in the art), orany arrangement in between “exact” binning and the most general boundingbox techniques could be used, etc., as desired. This is then repeatedfor each primitive in the scene.

Where a bounding box technique is being used, then the bounding boxescan be generated where and as desired. For example, the bounding boxescould be generated on a per primitive basis, or for a set or sets ofplural primitives, as is known in the art. The bounding boxes could,e.g., be generated by the graphics processor API or driver on the hostsystem.

In a preferred embodiment, where bounding boxes are used, the boundingboxes are generated at the primitive listing stage, by the graphicsprocessor or processing unit (preferably the processor that prepares theprimitive lists), e.g. by means of a suitable software or hardwareroutine. This allows the bounding boxes to be generated locally on thegraphics processor and then discarded once used for the primitivelisting process. Such an arrangement could, e.g., take in the verticesfor the primitive or primitives in question, and determine therefrom themaximum and minimum x, y positions for the primitive or primitives andthen generate a bounding box accordingly, as is known in the art.

According to a ninth aspect of the present invention, there is providedan apparatus for sorting primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided into pluralsub-regions for rendering, the apparatus comprising:

means for determining a sub-region or sub-regions that a primitive to berendered could or should be rendered for;

means for including the primitive in a list of primitives to be renderedfor a sub-region that it is determined that the primitive could orshould be rendered for; and

means for including the primitive in a list of primitives to be renderedfor a set of sub-regions comprising more than one sub-region thatincludes a sub-region that it is determined that the primitive could orshould be rendered for.

According to a tenth aspect of the present invention, there is provideda method of sorting primitives for rendering in a graphics processingsystem in which a scene to be rendered is divided into pluralsub-regions for rendering, the method comprising:

determining a sub-region or sub-regions that a primitive to be renderedcould or should be rendered for; and

including the primitive in a list of primitives to be rendered for asub-region that it is determined that the primitive could or should berendered for; or

including the primitive in a list of primitives to be rendered for a setof sub-regions comprising more than one sub-region that includes asub-region that it is determined that the primitive could or should berendered for.

These aspects of the invention can again include any one or more or allof the preferred and optional features of the invention describedherein, as appropriate. Thus, for example, the sub-regions that aprimitive could or should be rendered for could be determined using anexact binning technique (in which case the sub-regions that theprimitive could or should be rendered for will comprise exactly thosesub-regions that the primitive will appear in (falls within)), or couldbe determined using a bounding box technique (in which case thesub-regions that it is determined that the primitive could or should berendered for should comprise the sub-regions that the primitive willappear in (falls within) but may also include other sub-regions wherethe primitive does not in fact appear (but which are encompassed by thebounding box), as is known in the art), or could be determined using anyother suitable and desired technique.

A given primitive could, e.g., be included in the primitive list foreach and every sub-region and set of plural sub-regions that it isdetermined it should be rendered for (e.g., in the case of exactbinning, it is found to appear in). However, in a particularly preferredembodiment, a given primitive is only included in the primitive lists ofselected (a selected number of the) sub-regions and sets of pluralsub-regions that it is determined the primitive could or should berendered for, i.e. the primitive is selectively included in theprimitive lists of the sub-regions and sets of plural sub-regions thatit is determined that the primitive should be rendered for (e.g. thatthe primitive has been found to fall within).

Thus, for example, a primitive may be included in the primitive list fora sub-region (or the individual primitive lists for plural individualsub-regions) that the primitive is to be rendered for (e.g. has beenfound to fall within), and in a primitive list for a set of pluralsub-regions that the primitive is to be rendered for (e.g. has beenfound to fall within).

Such selective inclusion of primitives within the primitive listsfacilitates greater flexibility in terms, e.g., of the memory usage andrequirements for storing the primitive lists.

Thus, according to an eleventh aspect of the present invention, there isprovided an apparatus for sorting primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided into pluralsub-regions for rendering, the apparatus comprising:

means for selectively including primitives for rendering in a list ofprimitives corresponding to a single sub-region of the scene to berendered, and/or in a list of primitives corresponding to more than onesub-region of the scene to be rendered.

According to a twelfth aspect of the present invention, there isprovided a method of sorting primitives for rendering in a graphicsprocessing system in which a scene to be rendered is divided into pluralsub-regions for rendering, the method comprising:

selectively including primitives for rendering in a list of primitivescorresponding to a single sub-region of the scene to be rendered, and/orin a list of primitives corresponding to more than one sub-region of thescene to be rendered.

Again, these aspects of the present invention can include any one ormore or all of the preferred and optional features of the inventiondisclosed herein, as appropriate. Thus, for example, there arepreferably plural lists of primitives each corresponding to differentsub-regions or sets of sub-regions of the scene in which a primitive canselectively be listed.

In these aspects and embodiments of the invention, the arrangement ispreferably such that a primitive is not included in the primitive listsfor all the sub-regions and sets of plural sub-regions that it isinitially determined that the primitive could or should be rendered for(e.g. that the primitive or its bounding box is found to fall within orintersect or touch), but is included in the primitive lists of less thanall the sub-regions and sets of sub-regions that it is initiallydetermined that the primitive could or should be rendered for.

In other words, the arrangement is preferably such that a primitive canbe and preferably is only listed in some but not all of the separateprimitive lists in which it could or should be listed (i.e. theprimitive lists for all the sub-regions and sets of plural sub-regionsthat it is initially determined that the primitive could or should berendered for (e.g. that the primitive or its bounding box is found tofall within or intersect or touch)). Thus, a primitive is preferablylisted in at least one, but not all, of the separate primitive lists forall the sub-regions and sets of sub-regions that it is determined thatthe primitive could or should be rendered for.

The primitives can be selectively stored in the primitive lists of thesub-regions and sets of sub-regions that it is determined that theycould or should be rendered for (e.g. that they or their bounding boxare found fall within) in any suitable and desired manner. For example,preferentially listing the primitives for sets of plural sub-regions,rather than on a sub-region by sub-region basis, will reduce the memoryrequirements for storing the primitive (tile) lists (since fewerprimitive lists will be needed for the scene), and vice-versa. Thus, forexample, selectively listing primitives at the sub-region or at the setsof sub-regions level (or levels) can be used to vary and control thememory usage requirements for the tile listing process. The presentinvention accordingly facilitates a more flexible and controllable (atleast as regards memory usage requirements) tile listing process.

It is preferred for a given primitive only to be included in sufficientprimitive lists such that it can be rendered for all the scene areaswhere it is determined that it should be rendered for (e.g. where theprimitive or its bounding box is present). This helps to avoidunnecessary duplicated listing of primitives for the same scene area.Thus, in a particularly preferred embodiment, a primitive is listed inone primitive list only, in respect of each sub-region for which it isto be rendered. This list could be the primitive list for the individualsub-region or a primitive list for a set of plural sub-regions thatincludes the sub-region in question.

Thus, when a primitive is included in a primitive list for a set ofplural sub-regions, it is preferred that the primitive is not alsoincluded in the individual primitive lists of any of the sub-regionsthat are in the set of plural sub-regions.

Similarly, where there are plural sets of plural sub-regions allcovering the same scene area, it is again preferred that a primitive isnot included in the primitive lists for any sets of plural sub-regionsthat are entirely encompassed by a set of plural sub-regions in whoseprimitive list the primitive is included.

Thus, most preferably, a primitive is not included in the primitivelists of any sub-regions or sets of plural sub-regions that are entirelyencompassed (covered) by a larger set of plural sub-regions in whoseprimitive list the primitive is included.

It should be noted here that a given primitive may be listable in, and,indeed, may be included in, primitive lists at different levels ofresolution (i.e. scene area (different sized sets of sub-regions)) fordifferent regions of the scene. For example, a primitive may be includedin a primitive list for a single scene sub-region (tile) in part of thescene where it lies, but included in a primitive list for a set ofplural sub-regions (i.e. at a higher level) for another part of thescene where it appears. However, in a preferred embodiment, a givenprimitive is listed at one level of resolution only, i.e. the primitiveis listed for the same level (size) sets of sub-regions (or for singlesub-regions only) for all the scene regions where it is to be listed(rendered).

Where sets of plural sub-regions are arranged such that the scene iseffectively overlaid by plural layers of different resolution (size)scene areas, as discussed above, then in a particularly preferredembodiment, the primitives are allocated to primitive lists for thesub-regions or sets of sub-regions by testing a primitive, andpreferably each primitive, at each successive level (layer) of sets ofsub-regions, starting with the highest level (i.e. the level where theset or sets of sub-regions include the most sub-regions), to determinehow many different primitive lists the primitive would need to beincluded in at the level in question. This process is preferablycontinued iteratively down through the layers until it is determinedthat the number of primitive lists the primitive should be listed in ata given level (layer) exceeds a, preferably predetermined, thresholdnumber of lists, or the bottom, single sub-region level layer isreached.

Most preferably, once a layer is reached where the primitive would needto be included in more primitive lists than the threshold number if itwere to be listed at that level, then the primitive is in fact “listed”,i.e. placed in primitive lists for sets of sub-regions, at the precedinglevel (layer) (i.e. the final layer where the number of primitive listsit would need to be included in does not exceed the threshold number).This ensures that a primitive or each primitive should never be includedin more primitive lists than the threshold number of primitive lists,thereby facilitating, e.g., more precise control and knowledge of thememory usage requirement for the primitive (tile) lists.

Thus, in a particularly preferred embodiment, a primitive, andpreferably each primitive, is not listed in more than a selected,preferably predetermined, (threshold) number of primitive lists.

The threshold number of primitive lists to be used in these arrangementscan be selected as desired. Since, as discussed above, the thresholdnumber will, in effect, act as the maximum number of primitive liststhat a primitive will be listed in, it can be used to, in effect, setthe desired optimisation or compromise (trade-off) in the system betweenhaving to store more and longer primitive lists but with a consequentreduction in the amount of unnecessary processing of primitives at therendering stage (by setting a higher threshold number) and vice-versa.

The threshold number is preferably an integer greater than one,preferably greater than two and most preferably greater than three. In aparticularly preferred embodiment, the threshold number of primitivelists is four. The threshold number can preferably be varied and set inuse.

In a particularly preferred embodiment, the threshold number correspondsto the ratio of the numbers of sub-regions in the sets of sub-regions inimmediately successive layers in the sets of sub-regions hierarchy (i.e.the multiplying factor for the numbers of sets of sub-regions in eachsuccessive layer). Thus, for example, where the sets of sub-regions arearranged such that they are in successive layers of 1×1, 2×2, 4×4, 8×8,etc., sub-regions laid over the scene, i.e., such that the number ofsub-regions in each layer increases fourfold each time, the thresholdnumber is preferably four.

In a particularly preferred arrangement, where it is found that at thelevel (layer) one step up from the level (layer) where the primitivewould need to be listed in more than the threshold number of primitivelists, the number of primitive lists that a primitive will be listed inis equal to the threshold number (e.g. 4), it is then tested whether atthe next immediately preceding level, the primitive would need to beincluded in only a single primitive list, and if it would, the primitiveis listed in the single list at the higher level, rather than at thelevel where it needs to be listed in the threshold number of primitivelists.

In other words, where a primitive could be listed at one level in asingle primitive list (i.e. for a single set of sub-regions only), butat the next level down would have to be listed in the threshold numberof primitive lists (i.e. for the threshold number of sets of sub-regionsor sub-regions (at the lowest, single sub-region level)), (and the nextlevel down is more than the threshold number of primitive lists), thenit is preferred to list the primitive at the single list level, i.e. toinclude it in a single list only. In other words, if the number ofprimitive lists that a primitive would have to be listed in changes fromone to the threshold number of primitive lists (e.g. 4) on stepping downsuccessive levels, the primitive is preferably listed at the single listlevel. This is advantageous, because it allows the primitive to only beincluded in one list whilst still ensuring that the primitive isprocessed for all the sub-regions that it needs to be rendered for.

Thus, as can be seen from the above, in a particularly preferredembodiment, a given primitive is tested at each level in the sets ofsub-regions hierarchy, starting with the second from top level (sincethe top level will be a single list covering the entire scene), and thenthe third from top level, and so on, until it is found that theprimitive needs to be included more than the threshold number ofprimitive lists at a given level. The primitive will then be listed atthe immediately preceding level, i.e. at the list level where itrequires the threshold number or less of primitive lists to list theprimitive, except in the special case where at the next level up (i.e.the level two levels above the level where the threshold number ofprimitive lists is exceeded), it can be listed in a single primitivelist, in which case the primitive will be listed in that single list.

This will then be repeated for each primitive in the scene, until allthe primitives for the scene have been listed and primitive lists forall the sub-regions and sets of sub-regions that the scene is or can bedivided into have been prepared.

It would, of course, be possible to use other arrangements for decidingwhere (at what level in the sets of sub-regions' hierarchy) to list agiven primitive or primitives. For example, rather than, or as well as,considering the absolute number of primitive lists that will be neededto list a primitive at a given level, the difference in the number ofprimitive lists that a primitive would need to be included in at, e.g.,two, successive layers (levels) could be considered and used todetermine where to (at what level to) list a given primitive. Forexample, the difference could be compared to a threshold value and theprimitive listed on the basis of the result of that comparison. Otherarrangements would, of course, be possible.

The individual primitive lists and the primitives in them can bearranged in any desired and suitable fashion and include any desired andsuitable data. The lists are preferably arranged and contain data in themanner that is already used for such lists in the art. Thus theypreferably include, for example, an identifier for, and indices orpointers to the vertices for, each primitive in the list. The primitivesare preferably listed (ordered) in each list in the desired renderingorder (first to last), as this allows the primitives to be read from thelists on a first-in, first-out basis. As is known in the art, theprimitives will usually be generated in the order in which they are tobe rendered. In such a case the primitives can simply be, and preferablyare, listed in each list in the order that they are generated.

Once all the primitives have been sorted and primitive lists have beenprepared for the sub-regions and sets of sub-regions as discussed above,the sub-regions (tiles) can then be processed and rendered, using theprimitive lists to determine which primitives need to be processed foreach sub-region.

This rendering process may be and preferably is carried out in a similarmanner to known tile-based rendering systems. Thus, preferably, eachsub-region (tile) is processed and rendered separately, i.e. theseparate, individual sub-regions are rendered one-by-one. This renderingcan be carried out in any desired manner, for example, by rendering theindividual sub-regions in succession or in a parallel fashion. Once allthe sub-regions (tiles) have been rendered, they can then be recombined,e.g., in a frame buffer, for display, as is known in the art.

As will be appreciated by those skilled in the art, as each sub-regionis processed and rendered, in order to determine the primitives thatmust be processed and rendered for the sub-region it will be necessaryto check both the primitive list that is exclusive to that sub-region,and the primitive lists of all the sets of plural sub-regions thatinclude the sub-region.

The Applicants have recognised that this may mean that a primitivelisted in a primitive list for a set of plural sub-regions will beprocessed for each sub-region of the set of plural sub-regions,irrespective of whether or not it actually appears within a givenindividual sub-region of the set, and that a consequence of this is thatprimitives may be processed for sub-regions that they do not actuallyappear in. However, notwithstanding this, the Applicants believe thatthe present invention is still advantageous, as it allows, e.g., systemdesigners and application programmers to better and more readily controlany desired optimisation and trade-offs between, e.g., memory usagerequirements and graphics processing requirements than, e.g., prior artsystems.

This primitive list checking and the identifying of primitives to berendered for a given sub-region carried out as desired. However, in apreferred embodiment, the primitive lists are provided to a primitiveselection unit that selects the next primitive to be rendered from theprimitive lists and then provides that primitive to a rendering unit(e.g. pipeline) for rendering.

The primitive selection unit can take any appropriate form. In apreferred embodiment it comprises a tile read unit.

Most preferably, the different primitive lists, e.g. different level(resolution) lists that cover a given sub-region (tile) are provided tothe primitive selection unit in parallel (i.e. simultaneously), with theprimitive selection unit then selecting the next primitive to processfrom one of the lists. In other words, the primitive selection unit willreceive and support multiple primitive (tile) lists, and selectprimitives for rendering from those multiple lists.

It is believed that such arrangements may be new and advantageous intheir own right. Thus, according to a thirteenth aspect of the presentinvention, there is provided an apparatus for selecting a primitive forrendering in a graphics processing system, the apparatus comprising:

a primitive selection unit for selecting primitives for rendering; and

means for providing to the primitive selection unit plural lists ofprimitives in parallel; wherein

the primitive selection unit comprises means for selecting a primitiveto be rendered from one of lists of primitives provided to it.

According to a fourteenth aspect of the present invention, there isprovided a method of selecting a primitive for rendering in a graphicsprocessing system, the method comprising:

providing to a primitive selection unit plural lists of primitives inparallel; and

the primitive selection unit selecting a primitive to be rendered fromone of lists of primitives provided to it.

These aspects and embodiments of the invention can, and preferably do,as will be appreciated by those skilled in the art, include any one ormore or all of the preferred and optional features of the inventiondescribed herein. Thus, for example, the graphics processing system ispreferably a tile-based rendering system (in which case, the primitiveselection unit will, e.g., (and preferably does) comprise a tile readunit).

The next primitive for rendering could be selected from all theprimitive lists in parallel (e.g. the primitive selection unit couldsimply be provided with all the primitive lists in parallel for it tochoose the next primitive for rendering from). However, in a preferredembodiment, the next primitive for rendering is selected from (i.e. theprimitive list selection unit, where used, is provided with) only aselected set of (typically and preferably less than all of) theprimitive lists. Most preferably, the primitive is chosen from (theprimitive selection unit is provided with) all the primitive lists thatare known to include or cover the sub-region in question (i.e. thesub-region that is currently being rendered), and most preferably it ischosen from (the primitive selection unit is provided with) only thoseprimitive lists. In a particularly preferred embodiment, the primitiveis chosen from (the primitive list selection unit is simultaneouslyprovided with) a single primitive list for each level of resolution,i.e., where appropriate, a list for the single sub-region in question, alist for the 2×2 set of sub-regions that includes the sub-region inquestion, a list for the 4×4 set of sub-regions that includes thesub-region in question, a list for the 8×8 set of sub-regions thatincludes the sub-region in question, and so on.

The set of primitive lists that primitives are to be selected from for agiven tile (i.e. the set of primitive lists that the primitive selectionunit should read to identify primitives for rendering for a given tile)can be indicated (e.g. to the primitive selection unit) in any desiredfashion, for example by sending this data as appropriate to the graphicsprocessor (e.g. primitive selection unit). In a preferred embodiment,this information is sent when a new tile is to be rendered, e.g. as partof or associated with a “new tile” command (the command that tells therendering unit to start rendering a new tile). Thus, each sub-region(tile) preferably has associated with it in some way, the set ofprimitive lists to be used for the sub-region (tile). Other arrangementswould, of course, be possible.

The information indicating which primitive lists are to be used for agiven sub-region (tile) can be provided in any suitable and desiredform. In a preferred embodiment, a set of pointers or indices to therelevant primitive lists is provided. In another preferred arrangement,changes to the set of pointers or indices to the primitive lists areprovided, to allow the system to identify and change the primitive liststhat need to be changed when a new sub-region (tile) is to be rendered.It would also be possible to, e.g., prepare a predetermined set ofrelationships between the primitive lists to use and the x-y positionsof the sub-regions (tiles), which relationships could then be used todetermine the primitive lists to use for a sub-region (tile) on thebasis of the sub-region's (tile's) x, y coordinates. For example, the x,y position of a sub-region could be used to index into a look-up tablespecifying the primitive lists to be used for each sub-region position.Other arrangements would, of course, be possible.

The next primitive to be rendered can be chosen (e.g. by the primitiveselection unit) from the primitive lists that are provided (to be usedfor a sub-region) in any desired and suitable manner. For example, aprimitive from the lowest resolution list (e.g. a single sub-regionlist) could always preferentially be selected until the list isexhausted and so on, or vice-versa.

However, the Applicants have recognised that it can be important ingraphics processing to ensure that primitives are rendered in a desiredorder (typically the order in which they are first generated). This isnot a difficulty where there is only a single primitive list for a givensub-region (tile), since the primitives may be and will be added to andlisted in the primitive list in the correct order, i.e. one afteranother, on a first-in, first-out basis, as they are generated.

Indeed, as discussed above, the primitives are preferably listed inorder of their generation in the individual tile lists generated inaccordance with the present invention, and so for any given primitivelist, the primitives will where this arrangement is followed, be listedin the correct order in the individual primitive lists in any event.

However, it would still be desirable to be able to ensure that where,e.g., the primitive selection unit is provided with plural primitivelists from which to select the next primitive for renderingsimultaneously, the selection unit can select the primitives from thedifferent lists in the correct, desired order.

Thus, in a particularly preferred embodiment, the primitive generatingand sorting process is able to index or add an index to the primitives,preferably as they are included in the primitive lists, which index canthen be used, e.g., by the primitive selection unit, to select theprimitive to be processed next. This is preferably done by numbering theprimitives consecutively, preferably as they are included in theprimitive lists. Most preferably each primitive has associated with it asorting index which index is preferably allocated as the primitive isincluded in the primitive lists (i.e. at the primitive listing (binning)stage). The number (sorting index) allocated to a primitive or eachprimitive is preferably included in the primitive lists with theprimitive identifier, etc., preferably as the primitive is added to(listed in) the primitive list or lists that it is determined to theprimitive will be listed for.

The indexing can be done in any appropriate and desired manner. Forexample, a counter could be incremented each time a new primitive isprocessed for listing in the primitive lists (i.e. each time a newprimitive is “binned”) and the current count allocated to the primitive.Other indexing arrangements, such as using segmented indices, indexingthe primitives by groups or sets and then within each group or set,etc., would also, of course, be possible.

Such indexing of the primitives as they are listed (binned) assists withthe rendering process for a sub-region (tile), as it will, e.g.,facilitate rendering the primitives in the correct order. In particular,the (sorting) index given to each primitive can be used to select thenext correct (desired) primitive for rendering, thereby allowing, e.g.,the desired primitive order to be reconstructed when the primitives areto be rendered and helping to ensure that the primitives can be and aretaken from the different primitive lists for rendering in the desired(correct) order.

In this arrangement, the next primitive to process is preferablyselected, e.g. by the primitive selection unit, from the multipleprimitive lists on the basis of the indexes of the (next) primitives ineach of the lists (e.g., and preferably, of the next primitive in, e.g.the primitive effectively at the head of, each list). Where, e.g., theprimitives are indexed in ascending order (such that the lowest numberedprimitive is to be processed first), the primitive selection unit, forexample, preferably determines (reads) the index of the next primitivein each list and selects the lowest indexed primitive for renderingnext.

It is believed that such indexing arrangements for primitives may be newand advantageous in their own right. Thus, according to a fifteenthaspect of the present invention, there is provided a graphics processingsystem, comprising:

means for listing graphic primitives for rendering;

means for associating with each listed graphics primitive an index forthe primitive; and

means for using the indices associated with the graphics primitives tosort the primitives.

According to a sixteenth aspect of the present invention, there isprovided a method of operating a graphics processing system, comprising:

listing graphic primitives for rendering;

associating with each listed graphics primitive an index for theprimitive; and

using the indices associated with the graphics primitives to sort theprimitives.

As will be appreciated by those skilled in the art, these aspects of theinvention may and preferably do include any one or more of all thepreferred and optional features of the invention described herein, asappropriate. Thus, for example, the indices allocated to the primitivesare preferably used to order (sort) the primitives for rendering (i.e.to control the order in which the primitives are rendered), and arepreferably allocated to the primitives as they are listed (binned) inprimitive lists for rendering. Similarly, the primitives can preferablybe listed in primitive lists that are exclusive to single sub-regions ofthe scene to be rendered, and in primitive lists that are to be used forplural sub-regions of the scene in common, as discussed above.

The Applicants have further recognised that indexing primitives in themanner discussed above such that the correct order of the primitives canbe recreated when the primitives are to be rendered can be used tofacilitate other advantageous processes and operations for graphicsprocessing.

For example, and in particular, indexing the primitives in this mannercan facilitate processing the individual primitives in a distributedfashion, for example by plural different processors or processing units,since the indices can be used to regather (recombine) the distributedprimitives into the correct order when the primitives are to berendered. This would allow, for example, different primitives from astream of primitives to be rendered to be distributed between pluraldifferent geometry processors or processing units operating in parallel,with the primitives then being recombined into their original “stream”for rendering.

Thus, a primitive indexing arrangement of the type described above couldbe used, for example, to support and facilitate multiple geometry and/orbinning (primitive listing) engines operating in parallel on a givenstream (set) of primitives, with the commensurate increase in processingspeed, etc., that that could confer.

It is believed that such arrangements may be new and advantageous intheir own right. Thus, according to a seventeenth aspect of the presentinvention, there is provided a method of processing a group of graphicsprimitives for rendering, comprising:

distributing primitives from the group of primitives across multipleprocessing units; and

recombining the distributed primitives into a group of primitives.

According to an eighteenth aspect of the present invention, there isprovided an apparatus for processing a group of graphics primitives forrendering, the apparatus comprising:

means for distributing primitives from the group of primitives acrossmultiple processing units; and

means for recombining the distributed primitives into a group ofprimitives.

As will be appreciated by those skilled in the art, these aspects andarrangements of the invention can and preferably do include any one ormore or all of the preferred and optional features of the inventiondescribed herein, as appropriate.

Thus, for example, the group or set of primitives preferably comprises astream of primitives, such as a linear series of primitives in aparticular order. Similarly the group of primitives is preferablyrecombined into a single group of primitives (e.g., and preferably, intoa single stream of primitives). It would also be possible, e.g., as isknown in the art, for the group of primitives to not necessarily beprovided as a “stream” at a higher level of input to the system, but,e.g., to be configured as a stream for some or all of the underlyingprocesses of the system (and distributed in the manner of these aspectsand embodiments of the invention when not in the form of a stream and/orwhen in the form of a stream).

Thus, in a particularly preferred embodiment, the group of primitives isa stream of primitives, primitives from the stream are distributedacross the multiple processing units, and the distributed primitives arerecombined into a single stream of primitives.

Similarly, the primitives preferably each have an index associated withor allocated to them before they are distributed to the processingunits, which indices are preferably used when recombining thedistributed primitives, e.g. into the single stream. The indices arepreferably used to order or sort the primitives (e.g. to place them inthe desired order in the recombined stream).

Equally, the processing units that the primitives are distributed to arepreferably similar units (e.g. in terms of the functions and/oroperations that they can perform), and preferably each carry out thesimilar operations (functions) on the distributed primitives (althoughthis is, of course, not essential and different processing units andoperations could be used if desired or where appropriate). (It will beappreciated here that by the “same operations” it is intended that theprocessing units carry out the same form or type of operation or processon the primitives, although, in practice, the actual operations that areperformed will vary and depend, e.g., on the nature of and requirementsof each individual primitive.) The processing units preferably operatein parallel, e.g. such that they can each be operating on (processing) a(different) primitive simultaneously.

In a preferred embodiment, the processing units are geometry processors,and/or most preferably carry out one or more geometry processingoperations, such as transforming, clipping and/or lighting theprimitives, and/or carry out a primitive binning process (i.e. place theprimitives in primitive lists to be used to identify which primitives torender for a given sub-region or sub-regions of a scene to be rendered).

Similarly, the method and apparatus of these aspects and embodiments ofthe invention preferably includes a step of or means for rendering theprimitives. Most preferably in such an arrangement, the recombining ofthe distributed primitives into a common stream occurs prior to theprimitives being sent for rendering or as (at the same time as) theprimitives are sent for rendering.

According to a nineteenth aspect of the present invention, there isprovided a method of processing a group of graphics primitives fordisplay, comprising:

allocating an index to primitives in the group of primitives;

distributing primitives from the group of primitives across multipleprocessing units; and

using the indices allocated to the primitives to sort the primitivesafter they have been processed by the processing units.

According to a twentieth aspect of the present invention, there isprovided an apparatus for processing a group of graphics primitives fordisplay, the apparatus comprising:

means for allocating an index to primitives in the group of primitives;

means for distributing primitives from the group of primitives acrossmultiple processing units; and

means for using the indices allocated to the primitives to sort theprimitives after they have been processed by the processing units.

As will be appreciated by those skilled in the art, these aspects andarrangements of the invention can and preferably do include any one ormore or all of the preferred and optional features of the inventiondescribed herein, as appropriate.

Thus, for example, the group of primitives preferably comprises a set ofprimitives, and most preferably a stream of primitives.

Similarly, the primitives preferably each have an index associated withor allocated to them before they are distributed to the processingunits, and the indices are preferably used to order the primitives afterprocessing by the multiple processing units for subsequent processing ofthe primitives, and most preferably to (where appropriate) recombine thedistributed primitives into a single stream of primitives (having adesired primitive order).

Equally, the processing units that the primitives are distributed topreferably each carry out the same (similar) operations (functions),preferably operate in parallel, and most preferably carry out one ormore geometry processing operations, and/or carry out a primitivebinning process.

Similarly, the method and apparatus of these aspects and embodiments ofthe invention preferably include a step of or means for rendering theprimitives, and the indices allocated to the primitives are preferablyused to order the primitives for rendering.

Thus, according to a twenty-first aspect of the present invention, thereis provided a method of processing a group of graphics primitives fordisplay, comprising:

allocating an index to primitives in the group of primitives;

distributing primitives from the group of primitives across multipleprocessing units;

rendering primitives from the group of primitives; and

using the indices allocated to the primitives to control the order inwhich the primitives are rendered.

According to a twenty-second aspect of the present invention, there isprovided an apparatus for processing a group of graphics primitives fordisplay, the apparatus comprising:

means for allocating an index to primitives in the group of primitives;

means for distributing primitives from the group of primitives acrossmultiple processing units;

means for rendering primitives from the group of primitives; and

means for using the indices allocated to the primitives to control theorder in which the primitives are rendered.

As will be appreciated by those skilled in the art, these aspects andarrangements of the invention can and preferably do include any one ormore or all of the preferred and optional features of the inventiondescribed herein, as appropriate. Thus, for example, the primitives arepreferably in the form of a stream of primitives for rendering, theprimitives preferably each have an index associated with or allocated tothem before they are distributed to the processing units, and theprocessing units that the primitives are distributed to preferably eachcarry out the same (similar) operations (functions), preferably operatein parallel, and most preferably carry out one or more geometryprocessing operations, and/or carry out a primitive binning process.

Where a distributed primitive processing arrangement is used, then theprimitives in the primitive group (e.g. stream) can be distributed tothe individual processing units in any desired manner. For example, theprimitives could simply be distributed one-by-one to the availableprocessing units. In a preferred embodiment, a selected set or batch ofprimitives from the group (e.g. stream) is sent to one processing unit,with the next set or batch in the group being sent to the nextprocessing unit, and so on. The arrangement is preferably such that anygiven primitive in the group of primitives is sent to one processingunit only, although this is not essential.

In a particularly preferred embodiment, the primitives in the group(e.g. stream) of primitives are distributed to the multiple, e.g.parallel, processing units on a drawing call basis, preferably such thatall the primitives for a given drawing call are sent to the sameprocessing unit (but different drawing calls may be sent to, andpreferably are sent to, where possible, different processing units). Asis known in the art, in graphics processing primitives are commonlygrouped together in sets, e.g., for a particular scene region, which theprogrammer intends to be rendered in one go, together as a group. Suchgroups of primitives that are to be processed together are commonlyreferred to as “drawing calls”. Thus, distributing primitives forprocessing on a drawing call basis advantageously, for example, ensuresthat the primitives for a drawing call remain “together” when they areprocessed.

The primitives can be indexed (where this is used) in these arrangementsin any suitable manner (i.e., so long as the indexing permits thedesired primitive order (e.g. stream) to be recreated (e.g. whenrendering the primitives)). Thus, for example, all the primitives couldsimply be numbered consecutively, e.g., as they are distributed, e.g. ina similar manner to that discussed above.

However, in a preferred arrangement, particularly where the primitivesare distributed on a batch-by-batch (set-by-set) basis (e.g. on adrawing call basis), a combined or segmented indexing (numbering) schemeis used. Most preferably, the batches (e.g. drawing calls) are numbered,preferably consecutively, and then the primitives for (within) eachbatch are numbered (again, preferably consecutively). Thus, for example,for drawing call number 1, there may then be primitives 1 to n, and thenunder drawing call number 2, there would then be primitives 1 to m, andso on. In other words, the drawing calls would, for example, be indexed,and then the primitives within each drawing call indexed. When theprimitives are to be recombined, the system would then, e.g., take thedrawing calls (batches) in order, one after another, and take, for agiven drawing call, the primitives in order within each drawing call(batch).

In a preferred such embodiment, the indexing is arranged such that thehigher order bits (a selected set of the highest order bits) of theindex are used for the batch, e.g., drawing call number, and then the(remaining) lower order bits are used for the primitive number withinthe batch (e.g. drawing call). This provides a particularly convenientway of indexing the primitives on a per batch (e.g. drawing call) basis,and accordingly for distributing primitives in batches to pluralprocessors operating in parallel. In other words, segmented indexnumbers are preferably used, with the higher order bits representing thebatch (e.g. drawing call) number, and the lower order bits representingthe primitive number within the batch (e.g. drawing call).

As will be appreciated by those skilled in the art, in the abovearrangements, it may be the case that within a given batch, not all ofthe available primitive indices will be needed and thus used. In thiscase, when it comes to using the indices to order the primitives, e.g.,for rendering, the system would, once all the primitives for a givenbatch have been processed (e.g. rendered), then step to the next batch(drawing call) and start to, e.g., render primitives from there. Tofacilitate this, where desired, an indicator, such as a jump or linkcommand, could be included in the index to allow the system to recognisewhen the primitives for a given batch (e.g. drawing call) have beenexhausted, such that the system knows to then move on to the next batch(drawing call) in the index order.

Thus, it can be seen that in a preferred embodiment of thesearrangements and aspects of the invention, the stream or set ofprimitives that is to be rendered (e.g. for a scene) will be divided upinto separate batches (with each batch of primitives preferablycorresponding to a drawing call), with the batches of primitives beingdistributed to plural geometry and binning engines that are operating inparallel, which engines will carry out geometry operations such astransformations on the primitives that they receive and list theprimitives in primitive lists for sub-regions or sets of sub-regions ofthe screen. Thereafter, when it comes to rendering the primitives, therendering process can, as discussed above, use the indices associatedwith the primitives stored in the primitive lists to recreate thedesired and correct order for rendering the primitives.

In this way, these arrangements of the present invention can be used,for example, to allow geometry and primitive binning operations to becarried out in a distributed, parallel fashion, which could, forexample, be used to enhance the efficiency of the process.

Where, as in the above arrangements, indices are to be allocated toprimitives, this can be done in any suitable and desired manner. It ispreferably done before the primitives are distributed to the processingunits, and most preferably at the time of their distribution. It wouldbe possible, e.g., to allocate a complete index to each primitive in onego (e.g. at distribution time), or, e.g., the index could be allocatedin a number of stages. For example, where the primitives are distributedon a drawing call basis as discussed above, then the “drawing call”index could be allocated when the drawing call is distributed forprocessing, but the indexing of individual primitives within a drawingcall could be carried out later (or not at all), e.g., as the drawingcall is processed.

As will be appreciated by those skilled in the art, it would be possiblein the above arrangements simply to allow sufficient indices (e.g.numbers) such that it should be possible to index each and everyprimitive that could ever be generated for any given scene. However, theApplicants have recognised that this may not always be desirable. Forexample, it may be inefficient to allow for the possibility of indexingto a particularly large number of primitives for a scene that inpractice may rarely or never be reached. On the other hand, if theindexing is not arranged so as to be able to cope with the maximumnumber of primitives that any scene could require, there would be apossibility that the number of primitives for a scene could exceed thecapacity of the indexing that can be allocated to the primitives.

It would, e.g. be possible in such circumstances to return to thebeginning of the indexing (i.e. to “wrap around” the primitivenumbering). However, the Applicants have recognised that this may notalways be desirable or appropriate, since it could result in twodifferent primitives that are still “live” (i.e. that are still being orto be rendered) both having the same index.

Thus, in a particularly preferred embodiment, the system can recognisewhen the primitive indexing capacity has been reached or exhausted andin response thereto list the primitives such that from then on, there isonly a single primitive list to select primitives from for a givensub-region, e.g. such that the primitive selection unit will only readfor primitives after the index is exhausted a single primitive list fora given sub-region. This will ensure that, e.g., the primitive selectionunit only has a single primitive list from which to select primitivesfrom for rendering for any given sub-region once the indexing capacityhas been exhausted, and thereby ensure that once the system's capacityfor indexing the primitives consecutively has been exhausted, the systemcan still process the primitives (since from then on there will be onlya single primitive list from which to select primitives for renderingfor any given sub-region and thus there will no longer be a need tochoose between primitives in two or more lists).

This arrangement thus provides a fail-safe mode of operation in theevent that the available indices for primitives run out.

The above arrangement can be achieved in any desired and suitablemanner. In a preferred embodiment, it is achieved by the system listingall primitives generated after the indexing capacity has been exhaustedat the same, selected, preferably predetermined, level (layer) ofresolution, e.g. always in the single sub-region lists, or always in the2×2 sub-region lists, or always in the 4×4 sub-region lists, etc.

Thus, in a particularly preferred embodiment, the system is able torecognise that the index has reached the highest available index (e.g.the counter has reached its maximum value), and in response thereto willfrom then on always list the primitives at the same given, selected,preferably predetermined, level of resolution (layer).

In these arrangements it is preferred for the highest index numberavailable to be reserved and allocated to all the primitives generatedafter the penultimate index primitive has been generated, so as to allowthe system readily to identify when the “index-exhausted” state has beenreached and is in operation.

In a preferred embodiment, the system (e.g. primitive selection unit)can identify if it has already passed for rendering a primitive that itis currently selecting from for rendering, and can ignore the primitiveand look to select a different primitive in that event. This situationcould arise, e.g., if the same primitive appears in two differentprimitive lists that cover a given sub-region (tile), and the primitivehas already been rendered from one of the lists when it, e.g., arrivesat the head of the other list or lists that it is included in.Recognising this event allows the system to avoid rendering the sameprimitive twice.

Thus, in a preferred embodiment it can be recognised (e.g. the primitiveselection unit can recognise) when the primitive lists primitives are tobe selected from for rendering include the same primitive more than once(e.g. the same primitive is at the head of two or more of the primitivelists provided to the primitive selection unit simultaneously), so that,e.g. and preferably, avoid sending the same primitive for renderingtwice can be avoided.

The recognition of the repetition of a primitive in this manner can becarried out in any suitable and desired manner. For example, theprimitive selection unit or another unit could use the primitive indexesof the primitives (e.g. compare them) to see if they are repeated (e.g.match). If a duplicated or repeated primitive is recognised, then thesystem (e.g. primitive selection unit) preferably selects one forrendering and discards the other.

In a particularly preferred embodiment of the present invention, aprimitive list or lists can be and preferably is or are cached by or inthe graphics processor, most preferably by the primitive selection unit,i.e. the primitive lists can be and preferably are stored in a local,more rapidly accessible memory of the graphics processor. Thus, theapparatus and method of the present invention preferably include meansfor or a step of caching a primitive list or lists. Such caching canreduce bandwidth usage in respect of the primitive lists.

Preferably higher level (lower resolution) primitive lists, i.e. liststhat are for plural sub-regions of the scene, are cached. Caching suchprimitive lists is advantageous, because they will be reused whenprocessing different sub-regions (tiles), unlike primitive lists thatare exclusive to (unique to) a single sub-region (which will accordinglybe used once only), and so by caching these primitive lists, a moreefficient process can be achieved. Indeed, it is an advantage of thepresent invention that it facilitates the caching of primitive lists,and thus the more efficient caching of primitive data.

As well as caching primitive lists discussed above, other data couldalso be cached if desired. Indeed, in a particularly preferredembodiment, vertex data (vertices) are cached in the above manner, aswell as (or instead of) the primitive lists. This again has theadvantage that vertex data that may be used for more than one sub-regioncan be stored locally (cached) for use, rather than needing to beretrieved from external memory each time it is required.

The cached data may be stored in the same or different caches, as isknown in the art.

Where primitive limits and/or vertex (or other) data is cached in thisfashion, the storing of (and in particular the replacement of) data inthe cache is preferably based on the level in the “sets of sub-regions”hierarchy for which the data applies (e.g. whether it is stored for asingle sub-region only or for a set of plural sub-regions (and, e.g.,how many sub-regions there are in the set)), rather than, e.g. on asimple first-in, first-out basis. This facilitates preferentiallyretaining in the cache data that may be required for plural sub-regions.Preferably the higher the level that the data is stored for, the lowerits priority for replacement. Thus the “layer” (level) hierarchy ispreferably used to prioritise the replacement of data in the cache.

In a particularly preferred embodiment, the rendering order of theindividual sub-regions is selected, and preferably predetermined, so asto enhance the efficient usage of any cached data. Most preferably therendering order is selected so that the sub-regions are rendered in sucha fashion that a given set of sub-regions in one layer is completelyrendered before the next set of sub-regions in the layer is rendered.This will help to ensure that all the data for a given set ofsub-regions can be used and then safely discarded before the renderingof the next set of sub-regions is started.

In other words, it is preferred to render the individual sub-regions inan order that ensures that the boundaries between different sets ofsub-regions in a given layer are not crossed until all the sub-regionsin the first set of sub-regions have been rendered. This helps to ensurethat the data stored for a respective set of sub-regions need only becached for the minimum length of time.

Where, as discussed above, the arrangement is such that successivelayers have 1×1, 2×2, 4×4, 8×8, etc., sub-regions in their sets ofsub-regions, then this can be achieved by rendering the sub-regions inMorton order.

Although the present invention has been described above with referenceto the storing of primitive lists for individual sub-regions or sets ofmore than one sub-region, it would also or instead be possible to storeother graphics data on a similar basis. For example, there are otherforms of graphics data, such as graphics, e.g. rendering, settings, suchas scissoring parameters and primitive type parameters (e.g. whether aprimitive is a point, line, triangle or quad) and sub-region (tile)commands (e.g. a final tile command), that may be specified on a persub-region (tile) or group of sub-regions basis.

The Applicants have recognised that it could equally be advantageous tobe able to store (selectively) these types of data either on a persub-region basis, or for plural sub-regions in common, in a similarmanner to the primitive lists discussed above.

For example, if a particular parameter or command is to be used for eachand every sub-region, it may be preferable to store it in a singleprimitive (or other) list that is to be used for the whole scene incommon. On the other hand, for a command or data that is needed for oneor a few sub-regions only, it may be preferable to store it in respectof those sub-region(s) only, e.g. at a lower level in the hierarchy thatencompasses the relevant sub-region(s) only.

Thus, the system of the present invention can preferably also store dataand commands other than primitives in the manner described above forpreparing the primitive lists (for example, and preferably, in separate“lists” for individual sub-regions and for sets of plural sub-regions ofthe scene). Preferably these commands and data are stored at the levelin the sub-regions and sets of sub-regions hierarchy at which they willbe used or are needed, as exemplified above.

In these arrangements, the graphics data (e.g. commands and settings)could, for example, be stored in separate, e.g., “commands”, lists forthe sub-regions and sets of sub-regions. However, in a particularlypreferred embodiment, this graphics data is included in the primitivelists for the sub-regions and sets of sub-regions, i.e. such that a andpreferably each primitive list can and will include a list of primitivestogether with other graphics data, such as commands, settings and/orparameters interspersed within the list of primitives.

In a particularly preferred embodiment, this other graphics data isindexed in a similar manner to the primitives, as this will again allowthe data to be used in the correct order. Again, a separate index couldbe used for this data, but most preferably it is indexed within theindexing of the primitives, i.e. such that, for example, the system will(where, for example, a command is to be executed after the first threeprimitives have been rendered) render primitives 1, 2, 3, then executecommand 4, then render primitives 5, 6, . . . , and so on.

It is believed that the storing of data in this manner may be new andadvantageous in its own right.

Thus, according to a twenty-third aspect of the present invention, thereis provided an apparatus for sorting data and/or commands for use forrendering in a graphics processing system in which a scene to berendered is divided into a plurality of sub-regions for rendering, theapparatus comprising:

means for preparing, for a single sub-region of the scene, a set of dataand/or commands for use when rendering the sub-region; and

means for preparing, for a set of sub-regions comprising more than onesub-region of the scene, a set of data and/or commands for use whenrendering the sub-regions of the set of sub-regions.

According to a twenty-fourth aspect of the present invention, there isprovided a method of sorting data and/or commands for use for renderingin a graphics processing system in which a scene to be rendered isdivided into a plurality of sub-regions for rendering, the methodcomprising

preparing, for a single sub-region of the scene, a set of data and/orcommands for use when rendering the sub-region; and

preparing, for a set of sub-regions comprising more than one sub-regionof the scene, a set of data and/or commands for use when rendering thesub-regions of the set of sub-regions.

According to a twenty-fifth aspect of the present invention, there isprovided an apparatus for sorting data and/or commands for use forrendering in a graphics processing system in which a scene to berendered is divided into plural sub-regions for rendering, the apparatuscomprising:

means for including data or a command for use for rendering at least ina set of data and/or commands for use for rendering a single sub-regionof the scene or in a set of data and/or commands to be used forrendering more than one sub-region of the scene.

According to a twenty-sixth aspect of the present invention, there isprovided a method of sorting data and/or commands for use for renderingin a graphics processing system in which a scene to be rendered isdivided into plural sub-regions for rendering, the method comprising:

selectively including data or a command for use for rendering at leastin a set of data and/or commands to be used for rendering a singlesub-region of the scene or in a set of data and/or commands to be usedfor rendering more than one sub-region of the scene.

According to a twenty-seventh aspect of the present invention, there isprovided an apparatus for sorting data and/or commands for use forrendering in a graphics processing system in which a scene to berendered is divided into sub-regions for rendering, the apparatuscomprising:

means for including data or a command for use for rendering in one ormore sets of data and/or commands for use for rendering, wherein thesets of data and/or commands for rendering can be exclusive to a singlesub-region only or can be used for more than one sub-region of thescene.

According to a twenty-eighth aspect of the present invention, there isprovided a method of sorting data and/or commands for use for renderingin a graphics processing system in which a scene to be rendered isdivided into sub-regions for rendering, the method comprising:

including data and/or a command for use for rendering in one or moresets of data and/or commands for use for rendering, wherein the sets ofdata and/or commands for use for rendering can be exclusive to a singlesub-region only or can be used for more than one sub-region of thescene.

According to a twenty-ninth aspect of the present invention, there isprovided an apparatus for sorting data and/or commands for use forrendering in a graphics processing system in which a scene to berendered is divided into plural sub-regions for rendering, the apparatuscomprising:

means for selectively including data and/or commands for rendering in aset of data and/or commands for use for rendering corresponding to asingle sub-region of the scene to be rendered, and/or in a set of dataand/or commands for use for rendering corresponding to more than onesub-region of the scene to be rendered.

According to a thirtieth aspect of the present invention, there isprovided a method of sorting data and/or commands for use for renderingin a graphics processing system in which a scene to be rendered isdivided into plural sub-regions for rendering, the method comprising:

selectively including data and/or commands for use for rendering in aset of data and/or commands for use for rendering corresponding to asingle sub-region of the scene to be rendered, and/or in a set of dataand/or commands for use for rendering corresponding to more than onesub-region of the scene to be rendered.

According to a thirty-first aspect of the present invention, there isprovided a method of processing a stream of graphics data elements, themethod comprising:

distributing data elements from the stream of graphics data elementsacross multiple processing units operating in parallel; and

recombining the distributed data elements into a single stream ofgraphics data elements.

According to a thirty-second aspect of the present invention, there isprovided an apparatus for processing a stream of graphics data elements,the apparatus comprising:

means for distributing data elements from the stream of graphics dataelements across multiple processing units operating in parallel; and

means for recombining the distributed data elements into a single streamof graphics data elements.

According to a thirty-third aspect of the present invention, there isprovided a method of processing a stream of graphics data elements, themethod comprising:

allocating an index to data elements in the stream of graphics dataelements;

distributing data elements from the stream of graphics data elementsacross multiple processing units operating in parallel; and

using the indices allocated to the data elements to sort the dataelements after they have been processed by the processing unitsoperating in parallel.

According to a thirty-fourth aspect of the present invention, there isprovided an apparatus for processing a stream of graphics data elements,the apparatus comprising:

means for allocating an index to data elements in the stream of graphicsdata elements;

means for distributing data elements from the stream of graphics dataelements across multiple processing units operating in parallel; and

means for using the indices allocated to the data elements to sort thedata elements after they have been processed by the processing unitsoperating in parallel.

According to a thirty-fifth aspect of the present invention, there isprovided a method of processing a stream of graphics data elements, themethod comprising:

allocating an index to data elements in the stream of graphics dataelements;

distributing data elements from the stream of graphics data elementsacross multiple processing units operating in parallel;

processing data elements from the stream of graphics data elements; and

using the indices allocated to the data elements to control the order inwhich the data elements are processed.

According to a thirty-sixth aspect of the present invention, there isprovided an apparatus for graphics data elements, the apparatusprocessing a stream of graphics comprising:

means for allocating an index to data elements in the stream of graphicsdata elements;

means for distributing data elements from the stream of graphics dataelements across multiple processing units operating in parallel;

means for processing data elements from the stream of graphics dataelements; and

means for using the indices allocated to the data elements to controlthe order in which the data elements are processed.

As will be appreciated by those skilled in the art, the above aspects ofthe present invention can, and preferably do, include one or more of allof the preferred and optional features of the invention describedherein. Thus, for example, the data and/or commands stored for asub-region or for a set of more than one sub-region, preferablycomprises a list of primitives to be rendered for the sub-region or setof sub-regions, and/or other data or commands that are to be used forthe sub-region or set of sub-regions. In a preferred embodiment, itcomprises both a list of primitives to be rendered and other data andcommands to be used for a sub-region or set of sub-regions. Similarly,the graphics data elements preferably comprise graphics primitivesand/or other graphics data and/or commands.

It should also be noted here that although references herein to“primitives” are primarily intended to refer to graphics primitives inthe form of “simple” polygons such as triangles, grids, lines or points,etc., as is known in the art (and, in a preferred embodiment, do referto graphics primitives in the form of “simple” polygons such astriangles, quads, lines or points), the present invention is alsoapplicable to larger graphics objects or primitives, such as graphicscomponents or primitives that are intended to represent larger objectsin the scene and/or groups of smaller polygons (such as a group ofcontiguous triangles). For example, it may be desired to process andsort a group of plural individual polygons as a single graphical objector primitive. Such larger, “complex” primitives (“meta-primitives”) canequally be listed for sub-regions and sets of plural sub-regions in themanner of the present invention. Thus references herein to “primitives”,etc., should, unless the context otherwise requires, be interpretedaccordingly.

The various functions of the present invention can be carried out in anydesired and suitable manner. In a particularly preferred embodiment theyare carried out on a single graphics processing platform that generatesand outputs the graphics data that is written to the frame buffer forthe display device. The functions can be implemented in hardware orsoftware, as desired. In a preferred embodiment the system isimplemented as a hardware element (e.g. ASIC). Thus, in another aspectthe present invention comprises a hardware element including theapparatus of, or operated in accordance with the method of, any one ormore of the aspects of the invention described herein.

It should also be noted here that, as will be appreciated by thoseskilled in the art, the various functions, etc., of the presentinvention may be duplicated and/or carried out in parallel on a givenprocessor. There may be, for example, plural primitive selection unitsoperating in parallel.

The present invention is applicable to any form or configuration ofgraphics processor and renderer, such as renderers having a “pipelined”arrangement (in which case the renderer will be in the form of arendering pipeline).

As will be appreciated from the above, the present invention isparticularly, although not exclusively, applicable to 3D graphicsprocessors and processing devices, and accordingly extends to a 3Dgraphics processor and a 3D graphics processing platform including theapparatus of, or operated in accordance with the method of, any one ormore of the aspects of the invention described herein. Subject to anyhardware necessary to carry out the specific functions discussed above,such a 3D graphics processor can otherwise include any one or more orall of the usual functional units, etc., that 3D graphics processorsinclude.

It will also be appreciated by those skilled in the art that all of thedescribed aspects and embodiments of the present invention can include,as appropriate, any one or more or all of the preferred and optionalfeatures described herein.

The methods in accordance with the present invention may be implementedat least partially using software e.g. computer programs. It will thusbe seen that when viewed from further aspects the present inventionprovides computer software specifically adapted to carry out the methodsherein described when installed on data processing means, a computerprogram element comprising computer software code portions forperforming the methods herein described when the program element is runon data processing means, and a computer program comprising code meansadapted to perform all the steps of a method or of the methods hereindescribed when the program is run on a data-processing system. Theinvention also extends to a computer software carrier comprising suchsoftware which when used to operate a graphics processor, renderer ormicroprocessor system comprising data processing means causes inconjunction with said data processing means said processor, renderer orsystem to carry out the steps of the methods of the present invention.Such a computer software carrier could be a physical storage medium suchas a ROM chip, CD ROM or disk, or could be a signal such as anelectronic signal over wires, an optical signal or a radio signal suchas to a satellite or the like.

It will further be appreciated that not all steps of the methods of theinvention need be carried out by computer software and thus from afurther broad aspect the present invention provides computer softwareand such software installed on a computer software carrier for carryingout at least one of the steps of the methods set out herein.

The present invention may accordingly suitably be embodied as a computerprogram product for use with a computer system. Such an implementationmay comprise a series of computer readable instructions either fixed ona tangible medium, such as a computer readable medium, for example,diskette, CD-ROM, ROM, or hard disk, or transmittable to a computersystem, via a modem or other interface device, over either a tangiblemedium, including but not limited to optical or analogue communicationslines, or intangibly using wireless techniques, including but notlimited to microwave, infrared or other transmission techniques. Theseries of computer readable instructions embodies all or part of thefunctionality previously described herein.

Those skilled in the art will appreciate that such computer readableinstructions can be written in a number of programming languages for usewith many computer architectures or operating systems. Further, suchinstructions may be stored using any memory technology, present orfuture, including but not limited to, semiconductor, magnetic, oroptical, or transmitted using any communications technology, present orfuture, including but not limited to optical, infrared, or microwave. Itis contemplated that such a computer program product may be distributedas a removable medium with accompanying printed or electronicdocumentation, for example, shrink-wrapped software, pre-loaded with acomputer system, for example, on a system ROM or fixed disk, ordistributed from a server or electronic bulletin board over a network,for example, the Internet or World Wide Web.

A number of preferred embodiments of the present invention will bedescribed by way of example only and with reference to the accompanyingdrawings, in which:

FIG. 1 shows schematically a tile-based graphics-processing arrangement;

FIG. 2 shows schematically an arrangement of a graphics processor thatcan operate in accordance with the present invention;

FIG. 3 shows schematically an embodiment of a process for allocatingprimitives to primitive lists;

FIG. 4 shows schematically a set of primitives in a scene to berendered; and

FIG. 5 shows schematically an embodiment of an arrangement of sets ofsub-regions of a scene to be rendered.

A preferred embodiment of the present invention will now be describedwith reference to FIGS. 2, 3 and 4.

FIG. 2 shows schematically a graphics processor 20 that may be operatedin accordance with the present invention. The graphics processor 20includes a geometry processor 21, and a renderer 22, both of which canaccess a memory 23. The memory 23 may be, as is known in the art,“on-chip” with the geometry processor 21 and renderer 22, or may be anexternal memory that can be accessed by the geometry processor 21 andrenderer 22.

The memory 23 stores, inter alia, and as shown in FIG. 2, a set of rawgeometry data 24 (which is, for example, provided by the graphicsprocessor driver or an API running on a host system (microprocessor) ofthe graphics processor 20, as is known in the art), a set of transformedgeometry data 25 (which is the result of various transformation andprocessing operations carried out on the raw geometry 24, again, as isknown in the art), and a set of primitive lists 26. The primitive lists26 are prepared in accordance with the present invention. This processwill be described in more detail below.

The transformed geometry data 25 comprises, for example, transformedvertices (vertex data), etc., as is known in the art.

The geometry processor 21 comprises, inter alia, a programmable vertexshader 27, and a primitive list building unit 28. The programmablevertex shader 27 takes as it input the raw geometry data 24 stored inthe memory 23, and processes that data to provide transformed geometrydata 25 (which it then stores in the memory 23) comprising the geometrydata in a form that is ready for 2D placement in the frame to bedisplayed. The programmable vertex shader 27 and the processes itcarries out can take any suitable form and be any suitable and desiredsuch processes known in the art.

The primitive list building unit 28 carries out the process of thepresent invention of allocating the primitives to the primitive listswhich are then used by the renderer 22 to identify the primitives thatshould be rendered for each sub-region of the scene to be rendered. Todo this, the primitive list building unit 28 takes as its input thetransformed and processed vertex data from the programmable vertexshader 27 (i.e. the positions of the primitives in the scene), buildsprimitive (tile) lists using that data, and stores those lists as theprimitive lists 26 in the memory 23. This process will be described inmore detail below.

The renderer 22 includes a primitive selection unit 29, a primitive listcache 30, a vertex selection unit 31, a vertex data cache 32, arasterising unit 33, a rendering unit 34, and tile buffers 35.

The rasterising unit 33, rendering unit 34, tile buffers 35 operate, inthis embodiment, in the same manner as such units operate in existinggraphics processing systems. Thus the rasterising unit 33 takes as itsinput a primitive and its vertices, rasterises the primitive tofragments, and provides those fragments to the rendering unit 34. Therendering unit 34 then performs a number of rendering processes, such astexture mapping, blending, shading, etc. on the fragments, and generatesrendered fragment data which it stores in the tile buffers 35 forproviding to a frame buffer for display.

The primitive selection unit 29 of the renderer 22 determines whichprimitive is to be rendered next. It does this by considering theprimitive lists 26 stored in the memory 23, and selecting from one ofthose lists the next primitive to be rendered. This selection processagain will be described in more detail below.

The primitive selection unit 29 can also place one or more primitivelists in the primitive list cache 30.

The primitive selection unit 29 provides the primitive that it hasselected for rendering next to the vertex selection unit 31. In responseto this, the vertex selection unit 31 retrieves the appropriatetransformed vertex data for the primitive in question from thetransformed geometry data 25 stored in the memory 23, and then providesthe primitive (i.e. its transformed vertex data) to the rasterising unit33 for processing. The vertex selection unit 31 can cache vertex datathat it has retrieved from the memory 23 in the vertex data cache 32, ifdesired.

The operation of the primitive list building unit 28 and the preparationof the primitive lists 26 will now be described in more detail withreference to FIGS. 3, 4 and 5.

As discussed above, the present invention is applicable to a renderingsystem in which the scene to be rendered is divided into pluralsub-regions or tiles. Furthermore, as well as the scene being dividedinto the individual sub-regions, the sub-regions can be grouped togetherin sets of more than one sub-region which thereby in effect cover agreater portion of the screen area than a single sub-region.Furthermore, a separate (different) primitive list (i.e. a list ofprimitives to be rendered) can be and is prepared from each individualsub-region, and for each set of plural sub-regions that the systemsupports.

FIGS. 4 and 5 illustrate a preferred embodiment of an arrangement ofsub-regions and sets of sub-regions of a scene to be rendered that canbe used with the present invention.

As shown in FIG. 4, the scene 50 to be rendered is divided into pluralindividual sub-regions or tiles 51. (It should be noted here that FIG. 4does not show all the individual sub-regions 51 that the scene 50 isdivided into, but only a few of those sub-regions. This is for claritypurposes. However, the entire scene 50 is divided into equal sub-regions51 in practice.)

The individual sub-regions 51 are also grouped into differing groups ofsets of plural sub-regions, which groups of sets of sub-regions are ineffect laid over the scene 50 to provide different layers havingdifferent divisions of the overall scene area. Thus, as shown in FIG. 4,there is a “layer” of sixteen sets 52 of sub-regions each comprising 2×2sub-regions 52. There is then another, lower resolution layer comprisingfour sets 53 of 4×4 sub-regions. Finally, there is one set 54 of 8×8sub-regions which encompasses the entire scene area.

As can be seen from FIG. 4, the effect of this arrangement is that thescene 50 is overlaid with a progressively increasing hierarchy of screenarea divisions. This is shown schematically in FIG. 5. Thus there is atop level layer comprising a set 54 of 8×8 sub-regions which encompassesthe entire scene area 50. There is then a group of four 4×4 sets ofsub-regions 53, then a group of sixteen 2×2 sets of sub-regions 52, andfinally a layer comprising the 64 single sub-regions 51. FIG. 5 alsoshows in bold for illustrative purposes the sub-regions or sets ofsub-regions that a primitive 80 would be considered to fall within ateach layer (level) in the hierarchy.

FIG. 4 also shows for illustrative purposes three primitives 55, 56 and57 which are to be rendered and which accordingly need allocating toprimitive lists for rendering.

(Again, as will be appreciated by those skilled in the art, in practiceany given scene to be rendered will typically comprise many moreprimitives than the three primitives shown in FIG. 4. However, FIG. 4shows three primitives only for simplicity and clarity purposes.)

As discussed above, and as is known in the art, in a system where thescene 50 to be rendered is divided into smaller sub-regions 51 forrendering purposes, it is necessary for the system to be able toidentify which primitives should be rendered for each sub-region. Thisis done, as is known in the art, by providing so-called primitive ortile lists, which identify for each sub-region the primitives thatshould be rendered for that sub-region.

As discussed above, the present embodiment provides an improvement overexisting primitive list preparing processes, since as well as allowingprimitive lists to be prepared for the individual sub-regions that thescene is divided into, the present embodiment also prepares individualprimitive lists for sets of more than one sub-region, i.e. primitivelists that are to be used for plural sub-regions in common.

In the present embodiment, the primitive list building unit 28 preparesa primitive list for each individual sub-region 51, a separate primitivelist for each set of 2×2 sub-regions 52, a separate primitive list foreach set of 4×4 sub-regions 53, and a separate primitive list for theset of 8×8 sub-regions 54 that covers the entire scene 50. To do this,the primitive list building unit 28 takes each primitive in turn,determines a location for that primitive, compares the primitive'slocation with the locations of (the scene area covered by) thesub-regions 51 and the locations of (the scene area covered by) the setsof sub-regions 52, 53 and 54, and allocates the primitive to therespective primitive lists 26 for the sub-regions and sets ofsub-regions accordingly.

The primitive list building unit 28 determines the location of eachprimitive and accordingly the sub-regions and sets of sub-regions that agiven primitive falls within or intersects using, in this embodiment, anexact binning technique. Thus, as is known in the art, the primitivelist building unit 28 uses the determined transformed vertex positionsit is provided with for a given primitive by the programmable vertexshader 27 to identify which sub-regions and sets of sub-regions theprimitive falls within (intersects). This process can be carried out inany suitable and desired manner, such as by using techniques alreadyknown for this purpose in the art.

As will be appreciated by those skilled in the art, other techniques fordetermining and locating the primitives within the scene and in relationto the sub-regions or sets of sub-regions could be used if desired. Forexample, bounding box techniques could equally be used, as is known inthe art. (Where a bounding box technique is used, it is preferred forthe bounding box to be generated as part of the primitive listingprocess, e.g., by the primitive list building unit, but otherarrangements would, of course, be possible.)

The actual process that the primitive list building unit uses forallocating a given primitive to the primitive lists 26 for thesub-regions and sets of sub-regions will now be described with referenceto FIG. 3.

As shown in FIG. 3, the primitive list building unit 28 takes at itsinput the transformed primitive position data from the programmablevertex shader 27 for the primitive in question (step S60).

It then proceeds to test the primitive's position against the sets ofsub-regions and sub-regions at each different level (layer) that thescene is divided into. To do this, it starts at the level in the sets ofsub-regions' hierarchy which is one level below the top level (stepS61). Thus, in the present case, it will test the primitive at the levelof the sets 53 of 4×4 sub-regions shown in FIG. 4.

The primitive list building unit 28 then, using the provided primitiveposition, determines how many sets of sub-regions the primitive wouldneed to be listed for at the current level in the sets of sub-regions'hierarchy (step S62), and compares the determined number of sets ofsub-regions with a threshold number of sets of sub-regions, whichthreshold in the present embodiment is set to 4 (step S63).

If at this stage it is determined that the number of sets of sub-regionsthat the primitive would need to be listed for at the current level inthe sets of sub-regions' hierarchy is below the threshold number (i.e. 4in the present case), then the primitive list building unit 28 checks ifit is at the bottom level (i.e. the single sub-regions level) in thesets of sub-regions' hierarchy (step S64), and, if it is not, steps downto the next level in the hierarchy (step S65), determines how many setsof sub-regions would be needed to list the primitive at that level (stepS62) and so on, until such time as it is determined that the number ofsets of sub-regions needed at a given level in the hierarchy exceeds thethreshold number or it is determined at step S64 that the bottom levelof the hierarchy, i.e. the single sub-regions level, has in any eventbeen reached.

When it is determined that a given primitive needs to be listed in morethan a threshold number of sets of sub-regions at a given level in thehierarchy, the system then steps up to the preceding level in thehierarchy (step S66). The primitive list building unit 28 then tests ifthe special case of at the next level up in the hierarchy the primitivewould need to be included in a single primitive list only is met (stepS67). If this special case is met, then the primitive list building unit28 steps up to the next higher level in the hierarchy (step S68), andthen lists the primitive in the primitive list at that level (step S69),i.e. for the level where the primitive need only be included in a singleprimitive list.

On the other hand, if at step S67 it is determined that at the nextlevel up the primitives would still need to be listed in more than oneprimitive list, then the primitive is simply listed at the levelimmediately above the level where the threshold number of primitivelists was exceeded (step S69).

If at step S64 it is determined that the bottom level of the hierarchyhas been reached in any event, even though the threshold number ofprimitive lists has not been reached, then the primitive is immediatelylisted at that bottom level (step S69).

This process is then repeated for each primitive in turn.

This arrangement ensures, inter alia, that any given primitive willnever be included (listed) in more primitive lists than the specifiedthreshold number of primitive lists. It also, furthermore, ensures thatin the special case where a primitive can be included in a singleprimitive list at the level immediately above the level where it needsto be included in the threshold number of primitive lists, then it is soincluded in the single list (this allows the primitive to be stored oncein the primitive lists and yet still be processed efficiently for thesub-regions that it must be rendered for).

In other words, the primitive list building unit 28 will, starting atthe second from highest level in the sets of sub-regions' hierarchy,iteratively work down the sets of sub-regions' hierarchy until such timeas it finds that a primitive will need to be included in more than thethreshold number of primitive lists, and then go back up one level andlist the primitive at that level, except in the special case where goingup two levels would allow the primitive to be listed in a single listonly. This arrangement has been found by the Applicants to provide aparticularly efficient way of preparing primitive lists for use whenrendering sub-regions of a scene.

The operation of this process with respect to the primitives shown inFIG. 4 will now be described for illustrative purposes. In thisarrangement, it will be assumed that an exact binning technique is usedfor determining and locating the primitives in the scene, although, asdiscussed above, other techniques, such as the use of bounding boxes,would be possible if desired. In this example, it is assumed that thethreshold number of primitive lists for the purposes of determining atwhat level to list a primitive is four (a different threshold numberwould, of course, be possible if desired).

Taking firstly the primitive 55 shown in FIG. 4, the primitive listbuilding unit 28 would first determine how many of the sets 53 of 4×4sub-regions the primitive 55 would need to be listed in.

In this case, the primitive list building unit 28 will determine thatthe primitive 55 would need to be listed in two such sets of 4×4sub-regions 53.

As this does not exceed the threshold number of four primitive lists,the primitive list building unit then steps down to the next level inthe hierarchy, namely the level of the sets 52 of 2×2 sub-regions. Inthis case, the primitive list building unit again determines that theprimitive 55 would need to be listed in the primitive list of two of thesets 52 of 2×2 sub-regions, which again does not exceed the thresholdnumber of four primitive lists.

The primitive list building unit 28 accordingly steps down to the nextlevel in the hierarchy, which is the single sub-regions 51 level. Inthis case, it will determine that the primitive 55 would need to belisted in five single sub-region primitive lists, which exceeds thethreshold number of four lists. Thus, upon determining this, theprimitive list building unit 28 will step back up to the level of thesets 52 of 2×2 sub-regions, and list the primitive 55 at that level,namely include it in the primitive lists for each of the appropriate twosets 52 of 2×2 sub-regions. It should also be noted in this case thatwhen the primitive list building unit 28 tests for the special case, itwill determine that the primitive 55 is not included in the thresholdnumber of primitive lists at the level at which it is being listed, andso therefore does not fall within the special case set out above.

Turning now to the primitive 56, again the primitive list building unit28 will first test that primitive at the set 53 of 4×4 sub-regions'level, and accordingly determine that the primitive will need to belisted in the primitive list of one such set of sub-regions.

The primitive list building unit 28 will accordingly step down to thenext level of the sets 52 of 2×2 sub-regions, and again determine thatat that level the primitive 56 would need to be included in the list ofone such set of 2×2 sub-regions.

The primitive list building unit 28 will accordingly step down to thefinal, single sets of sub-regions 51 level, and determine that at thatlevel the primitive 56 would need to be listed in the primitive listsfor four single sub-regions 51.

The primitive list building unit would then test whether the primitive56 meets the special case specified above.

In this case, at the level of the single sub-regions 51, the primitive56 does need to be listed in the threshold number of primitive lists(i.e. four primitive lists), and accordingly the primitive list buildingunit 28 will step to the next higher level, namely the sets 52 of 2×2sub-regions, to determine whether at that level in the hierarchy theprimitive 56 would need to be included in a single primitive list only.In the case of the primitive 56, this test would be met, i.e. theprimitive 56 would only need to be listed in a single primitive list atthe level of the sets 52 of 2×2 sub-regions. Accordingly, the primitivelist building unit 28 will list the primitive 56 at the level of thesets 52 of 2×2 sub-regions, rather than at the single sub-regions 51level.

Finally, with regard to the primitive 57, the primitive list selectionunit would again test that primitive firstly at the sets 53 of 4×4sub-regions, and determine that at that level it would only need to beincluded in a single primitive list. It would accordingly then test theprimitive 57 again at the sets 52 of 2×2 sub-regions, and find that atthat level it would need to be included in the primitive lists of foursets of 2×2 sub-regions.

The primitive list selection unit would accordingly then test theprimitive 57 at the single sets of sub-regions level 51, and again findthat at that level it would need to be included in four primitive lists.

The primitive list building unit 28 would then test if the primitive 57meets the special case criteria described above. In this case, theprimitive 57 at the level above the single sets of sub-regions level 51would need to be included in four primitive lists for the sets 52 of 2×2sub-regions, and so the special case is not met. The primitive listbuilding unit 28 would accordingly list the primitive 57 at the singlesub-regions 51 level, namely in the primitive lists of the four singlesub-regions 51 that the primitive 57 falls within.

As will be appreciated by those skilled in the art, the above process isrepeated by the primitive list building unit 28 for each and everyprimitive in the scene to be rendered in turn, until complete tile lists26 have been generated for each single sub-region, and for each set ofmore than one sub-region, that the scene to be rendered can be dividedinto.

The primitive list building unit 28 places the primitives in theprimitive lists 26 in the order that it receives the primitives from theprogrammable vertex shader 27. This means that, so far as eachindividual primitive list 26 is concerned, the primitives in the listare in the order that they were generated, which will, as is known inthe art, typically correspond to the desired order of rendering theprimitives. (As is known in the art, when primitives are generated forrendering, they are usually generated by the host driver or API in theorder that it is desired to render the primitives and are provided tothe graphics processor in that order. Thus, as the primitive listbuilding unit 28 takes the primitives in turn as they are received, itwill place the primitives in the individual tile lists in renderingorder so far as each individual primitive list is concerned.)

The primitive list building unit 28, at the same time as it places aprimitive in the appropriate primitive list or lists, also allocates toand associates with the primitive in the primitive list 26 an index forthe primitive. The primitive list building unit 28 has a counter forthis purpose, and simply allocates to the primitives as they arerendered the current count of the counter. In this way, each primitiveis numbered (in ascending order in this embodiment) with the order inwhich it was received by the primitive list building unit 28 (i.e. inthe order in which the primitives are provided by the host driver orAPI, etc., i.e. the order in which it is desired for the primitives tobe rendered). The indices allocated by the primitive list building unit28 to each primitive are used by the primitive selection unit 29, aswill be discussed further below, to identify and select the nextprimitive for rendering from the primitive lists 26 in the memory 23.

This indexing of the primitives as they are placed in the primitivelists 26 is desirable, because, as is known in the art, and as discussedabove, it is usually desired in graphics processing systems to renderthe primitives in a particular order. This is not a problem where thereis only a single primitive list from which to take primitives forrendering, since in that case, as discussed above, the primitives willbe included in the primitive list in the order that they are provided tothe graphics processor, i.e. in the desired order for rendering.However, where, as in the present embodiment, the next primitive forrendering may need to be selected from more than one primitive list,selecting the primitives in the correct order for rendering may not beso straightforward. Indexing the primitives in the manner discussedabove helps to alleviate this difficulty, since it allows, as will bediscussed further below, the primitive selection unit 29 to identify theorder that the primitives were provided to the graphics processor forrendering, and accordingly, to select the next primitive in the order.

Although in this embodiment the primitives are simply indexed inascending order, it would be possible to use other indexingarrangements, if desired. For example, where the primitives to berendered are arranged in draw calls, the individual draw calls could benumbered consecutively, and then the primitives within each draw callnumbered consecutively. Such an arrangement would facilitate, forexample, processing different draw calls in parallel.

The primitive list building unit 28 is also configured to identify whenthe indexes it can allocate to the primitives have been or are about tobe exhausted. In particular, it is able to identify when the penultimateindex value (i.e. the penultimate counter value) has been reached. Inresponse to this event, the primitive list building unit switches to anarrangement in which it allocates all the primitives it receives forlisting from then on at the same level in the sets of sub-region'shierarchy (e.g. always at the single sub-regions level, or always at thesets of 2×2 sub-regions level, etc.). This ensures that when thepossibility of indexing the primitives in order has been exhausted, theprimitive selection unit 29 will then only ever be provided withprimitives at the same level in the sets of sub-region's hierarchy, suchthat it can still select the primitives in the correct order (since itwill not then need to choose between primitives from primitive lists 26at different levels in the hierarchy).

The actual level at which the primitives are listed in this arrangementonce the index has been exhausted can be selected as desired. It may bebased on, for example, a desired compromise or trade-off between havingto store more primitive lists if the primitives are listed at a lowerlevel in the hierarchy (i.e. for smaller scene areas) (which wouldrequire more memory) and having to perform more redundant andunnecessary processing of primitives at the rendering stage if theprimitives are listed at a higher level in the hierarchy (i.e. forlarger scene areas).

The primitive list building unit 28 also in these circumstancesallocates to every primitive that it subsequently receives for listingthe highest index (highest count number), as that then allows the systemto identify that the “index exhausted” state has been reached.

Once the primitive list building unit 28 has finished building theprimitive lists 26 and stored those lists in the memory 23, and theprogrammable vertex shader 27 has completed the transformation of thegeometry data to provide a complete set of transformed geometry data 25in the memory 23, for the scene to be rendered, the renderer 22 can thenrender the scene. This process will now be described below.

As discussed above, in the present embodiment, the rendering process isperformed on a sub-region by sub-region basis, i.e. each sub-region(tile) 51 of the scene is rendered individually in turn, and then therendered sub-regions (tiles) combined for display.

Thus, the renderer 22 is first provided with the identity of thesub-region to be rendered and uses this to configure itselfappropriately. In particular, the stored primitive lists 26 that applyto the sub-region that is to be rendered, i.e., in the presentembodiment, the primitive list that is exclusive to the individualsub-region that is to be rendered, the primitive list for the set of 2×2sub-regions that includes the sub-region that is to be rendered, theprimitive list for the set of 4×4 sub-regions that includes thesub-region that is to be rendered, and the primitive list for thecomplete set 54 of 8×8 sub-regions that covers the entire scene to berendered (and, accordingly, must cover the individual sub-region that iscurrently to be rendered) are identified. In the present embodiment, thestored primitive lists that apply to the sub-region (tile) beingrendered are indicated by including pointers to the relevant primitivelists in the “new tile” command that is sent when a sub-region (tile) isfirst to be rendered. (Other arrangements would, of course, bepossible.)

The renderer then proceeds to render the sub-region (tile) in question.

The first stage in the rendering process is for the primitive selectionunit 29 to select a primitive to be rendered. To do this, the primitiveselection unit 29 reads the stored primitive lists 26 that have beendetermined as applying to the sub-region that is currently beingrendered, i.e., in the present embodiment, as discussed above, theprimitive list 26 that is exclusive to the individual sub-region that isbeing rendered, the primitive list for the set of 2×2 sub-regions thatincludes the sub-region that is being rendered, the primitive list forthe set of 4×4 sub-regions that includes the sub-region that is beingrendered, and the primitive list for the complete set 54 of 8×8sub-regions that covers the entire scene to be rendered. The primitivelists are read in a first-in, first-out order by the primitive selectionunit 29, i.e. such that, in effect, the first primitive in a list isread, and then, once that primitive has been sent for rendering, thesecond primitive in the list is read, and so on.

To select the next primitive to be rendered, the primitive selectionunit 29 determines the index that have been allocated to the nextprimitive to be rendered in each primitive list for the sub-region beingrendered, compares those indices, and selects the lowest index primitiveas the next primitive to be rendered (since, as discussed above, theprimitives are indexed by the primitive list building unit 28 inascending order, i.e. such that the lowest numbered primitive is thenext primitive to be rendered for the desired rendering order).

Thus the primitive selection unit 29 will read in the index of the nextprimitive in the primitive list for the sub-region in question, theindex of the next primitive in the primitive list for the relevant setof 2×2 sub-regions, the index of the next primitive in the primitivelist for the appropriate set of 4×4 sub-regions, and so on, comparethose indices, and select the primitive with the lowest index forrendering next. (The primitive selection unit 29 only needs to read theindex of one primitive (the next primitive) from each primitive list atany one time, since, as discussed above, within the individual primitivelists, the primitives are already listed in the correct renderingorder.) In effect, the primitives can be thought of as being streamedone-by-one to the primitive selection unit in order from the storedprimitive lists, on a first-in, first-out basis.

Once the primitive selection unit 29 has selected the primitive to berendered, it passes that primitive to the vertex selection unit 31. Thevertex selection unit 31 then retrieves the appropriate transformedgeometry data for the vertices of the primitive in question from thetransformed geometry data 25 stored in the memory 23, and provides thatdata to the rasterising unit 33. The primitive is then rasterised andrendered, as discussed above, and as is known in the art.

The process is then repeated, i.e. the primitive selection unit 29 againreads the index of the next primitive of each relevant primitive list,selects the primitive with the lowest index, and provides that primitiveto the vertex selection unit 31, and so on.

This process is repeated for all the primitives that need to be renderedfor a given sub-region (i.e. that are included in primitive lists 26appropriate to the sub-region) until all the primitives for thesub-region have been rendered.

The renderer 22 then proceeds to render the next sub-region in the samemanner, and so on, until all the individual sub-regions for the scenehave been rendered.

Once all the sub-regions for the scene have been rendered, the renderedsub-regions are combined and provided to a display device for display,as is known in the art.

The primitive selection unit 29 is also configured to be able toidentify the situation where the same primitive (i.e. primitives havingthe same index) appears simultaneously at the current reading positionof more than one primitive list that it is currently reading primitivesfrom. This is done by the primitive selection unit comparing the indicesand identifying if a match occurs. In these circumstances, the primitiveselection unit 29 is configured to select the relevant primitive oncefor rendering, and to ignore the subsequent duplicate occurrences ofthat primitive. This avoids a given primitive unnecessarily beingrendered more than once for a given sub-region.

As discussed above, the renderer 22 also includes a primitive list cache30 and a vertex data cache 32. These caches, as is known in the art,comprise local memory provided on the renderer 22 that can be morerapidly accessed by processing units of the renderer (and in particularthe primitive selection unit 29 and vertex selection unit 31,respectively) than the main memory 23.

The primitive selection unit 29 is configured to store in the primitivelist cache 30 one or more primitive lists 26 that it has read from themain memory 23. In particular, the primitive selection unit 29preferentially retrieves from the memory 23 and stores in the primitivelist cache 30 primitive lists that apply to sets of more than onesub-region of the scene that, for example, the primitive selection unit29 knows it will require for subsequent sub-regions of the scene. Thishelps to avoid delays and latency due to the primitive selection unit 29having to retrieve repeatedly from the memory 23 primitive lists that itwill require for rendering sub-regions of the scene.

The vertex selection unit 31 can similarly cache vertex data that itretrieves from the transformed geometry data 25 in the memory 23 in thevertex data cache 32, again in particular where it can be identifiedthat the vertex data will be required for a primitive again (for examplebecause it is known that the primitive is listed for a set of pluralsub-regions that are to be rendered).

In the present embodiment, the storing of and in particular thereplacement of, the data cached in the primitive list cache 30 andvertex data cache 32 is based on the level in the sets of sub-region'shierarchy to which the primitive list and/or vertex data applies or hasbeen stored in respect of, such that, for example, primitive lists andvertex data that apply to higher levels in the hierarchy (i.e. that willtherefore be used for more sub-regions in the scene to be rendered) arepreferentially cached and retained in the caches as compared toprimitive lists and vertex data that it is known apply, for example, toa single sub-region or only a few sub-regions.

Thus, for example, when the vertex selection unit 31 reads transformedvertices from the transformed geometry data 25 in the memory 23, it willknow at what level the primitive that that vertex data applies to hasbeen listed (i.e. the primitive list that the primitive has come from),and can use that information to, for example, decide whether or not tocache the vertex data (e.g., based, as discussed above, on whether ornot it is likely that that vertex data will be re-used for subsequentsub-regions).

The order that the sub-regions of the scene are processed by therenderer 22 can be selected as desired. However, in a preferredembodiment, the sub-regions are processed in Morton order, as thisfacilitates, for example, the more efficient caching of primitive listsand vertex data in the renderer 22.

Although the present embodiment has been described above with particularreference to the preparation of primitive lists for individualsub-regions and sets of sub-regions, it would also be possible to, andindeed is preferred to, store other data that may be used on asub-region or plural sub-regions basis in a similar manner. Such datacould comprise, for example, rendering settings, tiling commands,scissoring parameters, etc. It would be advantageous if, for example,such a command is to be used for every sub-region, to place the commandin a list that applies to all the sub-regions together, or,alternatively, if a command only applies to a few sub-regions, to storethe command at a lower level in the hierarchy. Preferably, this data isalso stored in or associated with the respective primitive lists thatare prepared for each sub-region and set of sub-regions, as appropriate,and most preferably is indexed in a similar manner to that discussedabove for the primitives.

As will be appreciated by those skilled in the art, the presentembodiment (and the present invention) can be implemented in anytile-based rendering system, as desired. The various components andfunctions of the present embodiment and the present invention cansimilarly be implemented as desired and using any suitable techniquesknown in the art.

It can be seen from the above that the present invention, in itspreferred embodiments at least, provides an improved primitive listingand sorting arrangement for tile-based rendering systems that inparticular facilitates better control over and knowledge of the memoryusage and requirements for the tile-listing (primitive sorting(binning)) process. It also provides information about the distributionand layout of primitives in a scene, thereby, e.g., facilitatingimproved vertex caching, etc., and facilitates the caching of primitive(tile) lists, and the more efficient caching of primitive data.

This is achieved, in the preferred embodiments of the present inventionat least, by listing primitives (and other data and commands, ifdesired) in differing resolution tile lists, namely in tile lists thatare exclusive to a single tile, and in tile lists that are to be usedfor plural tiles in common.

1. An apparatus for sorting graphics primitives for rendering in agraphics processing system in which a scene to be rendered is dividedinto a plurality of sub-regions for rendering, each sub-region includinga respective area of the scene to be rendered, the apparatus comprising:at least one processor configured to prepare a set of plural first listsof primitives, each first list of primitives in the set of first listsof primitives being exclusive to a respective single sub-region of thescene and listing primitives for rendering for that single sub-region ofthe scene; wherein the at least one processor is further configured toprepare a set of plural second lists of primitives, the set of pluralsecond lists of primitives being in addition to the set of plural firstlists of primitives, and each second list of primitives in the set ofsecond lists of primitives being a list of primitives to be used for arespective set of at least two sub-regions of the scene in common andlisting primitives for rendering for that set of at least twosub-regions of the scene; and wherein: the at least one processorprepares the set of first primitive lists and the set of secondprimitive lists by, for each primitive of a set of graphics primitivesto be rendered for the scene: determining a location for the primitivein the scene; comparing the determined location for the primitive in thescene to the sub-regions and sets of plural sub-regions that the sceneis divided into and for which primitive lists can be prepared, todetermine which sub-regions and sets of plural sub-regions the primitiveshould be rendered for; and in response to the determination of thesub-regions and sets of plural sub-regions that the primitive should berendered for, selectively including the primitive in at least one of: afirst list of primitives of the set of first lists of primitives that isexclusive to a sub-region that it has been determined the primitiveshould be rendered for; and a second list of primitives of the set ofsecond lists of primitives that is for a set of plural sub-regions thatincludes a sub-region that it has been determined that the primitiveshould be rendered for; and further wherein said apparatus is configuredto render each sub-region that the scene to be rendered has been dividedinto for rendering, including when rendering a sub-region of the scene,said apparatus being configured to: use said lists to determine which ofsaid primitives should be rendered for which of said sub-regions,including: when rendering a sub-region of the scene, said apparatusbeing configured to: use both the first list of primitives of the set offirst lists of primitives that is exclusive to that sub-region of thescene, and each second list of primitives in the set of second lists ofprimitives that is for a set of at least two sub-regions of the scenethat includes the sub-region of the scene being rendered, to determinewhich primitives should be rendered for the sub-region.
 2. The apparatusof claim 1, wherein: each second list of primitives in the set of secondlists of primitives is a list of primitives to be used for a respectiveset of 2×2 sub-regions of the scene in common and lists primitives forrendering for that set of 2×2 sub-regions of the scene; and the at leastone processor is further configured to prepare a set of plural thirdlists of primitives, the set of plural third lists of primitives beingin addition to the set of plural first lists of primitives and the setof plural second lists of primitives, and each third list of primitivesin the set of third lists of primitives being a list of primitives to beused for a respective set of 4×4 sub-regions of the scene in common andlisting primitives for rendering for that set of 4×4 sub-regions of thescene.
 3. The apparatus of claim 1, wherein the at least one processoris configured to include a primitive in only one primitive list inrespect of a sub-region for which the primitive is to be rendered. 4.The apparatus of claim 1, wherein the at least one processor isconfigured to select the lists of primitives that a primitive isincluded in such that the primitive is not listed in more than athreshold number of primitive lists.
 5. The apparatus of claim 1,wherein the at least one processor is configured to preferentiallyinclude a primitive in one or more second lists of primitives of the setof second lists of primitives when selectively including the primitivein at least one of: a first list of primitives of the set of first listsof primitives and a second list of primitives of the set of second listsof primitives.
 6. The apparatus of claim 1, wherein the apparatus isfurther configured to, when rendering a sub-region of the scene, useindices associated with the primitives to select a primitive to berendered next for the sub-region.
 7. A graphics processing system inwhich a scene to be rendered is divided into a plurality of sub-regionsfor rendering, each sub-region including a respective area of the sceneto be rendered, the system comprising: primitive list building circuitryconfigured to prepare lists of primitives for rendering, each list ofprimitives listing primitives for rendering for one or more sub-regionsof the scene; the primitive list building circuitry further comprising acounter configured to generate indices for primitives that are includedin the primitive lists by the primitive list building circuitry; and theprimitive list building circuitry further being configured to associatewith each graphics primitive that it lists in a primitive list, an indexfor the primitive; the graphics processing system further comprising:primitive selection circuitry configured to, when rendering a sub-regionof the scene, select from a primitive list a next primitive to berendered for that sub-region of the scene; wherein the primitiveselection circuitry is configured to receive plural different primitivelists simultaneously and to select the next primitive to process for asub-region of the scene from one of the primitive lists it receivesusing the indices associated with the graphics primitives in theprimitive lists.
 8. The system of claim 7, wherein the primitiveselection circuitry is configured to use the primitive indexes toidentify when a primitive having an index that it has already passed forrendering for the sub-region of the scene arises, and to, in that event,select a different primitive for rendering for the sub-region of thescene.
 9. The system of claim 7, wherein the primitive selectioncircuitry is configured to, when the primitive lists it receives includethe same primitive more than once, select the primitive for renderingonly once.
 10. A method of sorting graphics primitives for rendering ina graphics processing system in which a scene to be rendered is dividedinto a plurality of sub-regions for rendering, each sub-region includinga respective area of the scene to be rendered, the method comprising: atleast one processor of the graphics processing system preparing a set ofplural first lists of primitives, each first list of primitives in theset of first lists of primitives being exclusive to a respective singlesub-region of the scene and listing primitives for rendering for thatsingle sub-region of the scene; wherein the at least one processorfurther prepares a set of plural second lists of primitives, the set ofplural second lists of primitives being in addition to the set of pluralfirst lists of primitives, and each second list of primitives in the setof second lists of primitives being a list of primitives to be used fora respective set of at least two sub-regions of the scene in common andlisting primitives for rendering for that set of at least twosub-regions of the scene; and wherein the at least one processorprepares the set of first primitive lists and the set of secondprimitive lists by, for each primitive of a set of graphics primitivesto be rendered for the scene: determining a location for the primitivein the scene; comparing the determined location for the primitive in thescene to the sub-regions and sets of plural sub-regions that the sceneis divided into and for which primitive lists can be prepared, todetermine which sub-regions and sets of plural sub-regions the primitiveshould be rendered for; and in response to the determination of thesub-regions and sets of plural sub-regions that the primitive should berendered for, selectively including the primitive in at least one of: afirst list of primitives of the set of first lists of primitives that isexclusive to a sub-region that it has been determined the primitiveshould be rendered for; and a second list of primitives of the set ofsecond lists of primitives that is for a set of plural sub-regions thatincludes a sub-region that it has been determined that the primitiveshould be rendered for; the method further comprising: rendering eachsub-region that the scene to be rendered has been divided into forrendering, including when rendering a sub-region of the scene: usingsaid lists to determine which of said primitives should be rendered forwhich of said sub-regions, including: when rendering a sub-region of thescene: using both the first list of primitives of the set of first listsof primitives that is exclusive to that sub-region of the scene, andeach second list of primitives in the set of second lists of primitivesthat is for a set of at least two sub-regions of the scene that includesthe sub-region of the scene being rendered, to determine whichprimitives should be rendered for the sub-region.
 11. The method ofclaim 10, wherein: each second list of primitives in the set of secondlists of primitives is a list of primitives to be used for a respectiveset of 2×2 sub-regions of the scene in common and lists primitives forrendering for that set of 2×2 sub-regions of the scene; and the at leastone processor further prepares a set of plural third lists ofprimitives, the set of plural third lists of primitives being inaddition to the set of plural first lists of primitives and the set ofplural second lists of primitives, and each third list of primitives inthe set of third lists of primitives being a list of primitives to beused for a respective set of 4×4 sub-regions of the scene in common andlisting primitives for rendering for that set of 4×4 sub-regions of thescene.
 12. The method of claim 10, wherein the at least one processorincludes a primitive in only one primitive list for each sub-region forwhich the primitive is to be rendered.
 13. The method of claim 10,wherein the at least one processor selects the lists of primitives thata primitive is included in such that the primitive is not listed in morethan a threshold number of primitive lists.
 14. The method of claim 10,wherein the at least one processor preferentially includes a primitivein one or more second lists of primitives of the set of second lists ofprimitives when selectively including the primitive in at least one of:a first list of primitives of the set of first lists of primitives and asecond list of primitives of the set of second lists of primitives. 15.The method of claim 10, further comprising: including a primitive inboth a first list of primitives of the set of first lists of primitivesand a second list of primitives of the set of second lists ofprimitives.
 16. The method of claim 10, further comprising: whenrendering a sub-region of the scene, using indices associated with theprimitives to select a primitive to be rendered next for the sub-region.17. A method of rendering a group of graphics primitives for display ina graphics processing system, comprising: allocating an index to eachprimitive in the group of primitives; distributing the primitives fromthe group of primitives across multiple geometry processors of thegraphics processing system; processing the primitives in the geometryprocessors; recombining the primitives that have been processed in thegeometry processors into a single stream of primitives using the indicesallocated to the primitives; rendering primitives from the stream ofprimitives; and displaying the rendered primitives.
 18. Anon-transitory, computer-readable storage medium, said storage mediumstoring computer software code which, when implemented on a graphicsprocessing system, performs a method of sorting graphics primitives forrendering, in which a scene to be rendered is divided into a pluralityof sub-regions for rendering, each sub-region including a respectivearea of the scene to be rendered, the method comprising: preparing a setof plural first lists of primitives, each first list of primitives inthe set of first lists of primitives being exclusive to a respectivesingle sub-region of the scene and listing primitives for rendering forthat single sub-region of the scene; further preparing a set of pluralsecond lists of primitives, the set of plural second lists of primitivesbeing in addition to the set of plural first lists of primitives, andeach second list of primitives in the set of second lists of primitivesbeing a list of primitives to be used for a respective set of at leasttwo sub-regions of the scene in common and listing primitives forrendering for that set of at least two sub-regions of the scene; themethod further comprising: preparing the set of first primitive listsand the set of second primitive lists by, for each primitive of a set ofgraphics primitives to be rendered for the scene: determining a locationfor the primitive in the scene; comparing the determined location forthe primitive in the scene to the sub-regions and sets of pluralsub-regions that the scene is divided into and for which primitive listscan be prepared, to determine which sub-regions and sets of pluralsub-regions the primitive should be rendered for; and in response to thedetermination of the sub-regions and sets of plural sub-regions that theprimitive should be rendered for, selectively including the primitive inat least one of: a first list of primitives of the set of first lists ofprimitives that is exclusive to a sub-region that it has been determinedthe primitive should be rendered for; and a second list of primitives ofthe set of second lists of primitives that is for a set of pluralsub-regions that includes a sub-region that it has been determined thatthe primitive should be rendered for; the method further comprising:rendering each sub-region that the scene to be rendered has been dividedinto for rendering, including when rendering a sub-region of the scene:using said lists to determine which of said primitives should berendered for which of said sub-regions, including: when rendering asub-region of the scene: using both the first list of primitives of theset of first lists of primitives that is exclusive to that sub-region ofthe scene, and each second list of primitives in the set of second listsof primitives that is for a set of at least two sub-regions of the scenethat includes the sub-region of the scene being rendered, to determinewhich primitives should be rendered for the sub-region.